import { gql,TypedDocumentNode } from "@apollo/client";
import { SaveCheckoutCartData } from "@/types/checkout/type";

export const CREATE_SAVE_CHECKOUT_CART: TypedDocumentNode<SaveCheckoutCartData> = gql`
    mutation CreateSaveCheckoutCart(
        $shippingMethod: String
        $paymentMethod: String
        $couponCode: String
    ) {
      createSaveCheckoutCart(
        input: {
            shippingMethod: $shippingMethod
            paymentMethod: $paymentMethod
            couponCode: $couponCode
        }
        ) {
            saveCheckoutCart {
                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
            }
        }
    }
`;