import { gql, TypedDocumentNode } from "@apollo/client";
import { CreateMergeCartData } from "@/types/cart/type";

export const CREATE_MERGE_CART: TypedDocumentNode<CreateMergeCartData> = gql`
  mutation createMergeCart(
    $cartId: Int!
  ) {
    createMergeCart(
      input: {
        cartId: $cartId
      }
    ) {
      mergeCart {
        id
        appliedTaxes
        itemsQty
        isGuest
        itemsCount
        items {
          edges {
            node {
              id
              cartId
              productId
              name
              price
              baseImage
              sku
              quantity
              type
              productUrlKey
              canChangeQty
            }
          }
        }
        subtotal
        subTotalInclTax
        discountAmount
        taxAmount
        taxTotal
        shippingAmount
        shippingAmountInclTax
        grandTotal
        formattedSubtotal
        formattedSubTotalInclTax
        formattedDiscountAmount
        formattedTaxAmount
        formattedTaxTotal
        formattedShippingAmount
        formattedShippingAmountInclTax
        formattedGrandTotal
        couponCode
        selectedShippingRate
        selectedShippingRateTitle
        paymentMethod
        paymentMethodTitle
        haveStockableItems
        billingAddress
        shippingAddress
      }
    }
  }
`;
