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

export const CREATE_PAYMENT_INITIATE: TypedDocumentNode<CreatePaymentInitiateData> = gql`
  mutation CreatePaymentInitiate(
      $expressCheckout: Boolean
      $paymentMethod: String
      $paymentSuccessUrl: String
      $paymentFailureUrl: String
      $paymentCancelUrl: String
  ) {
      createPaymentInitiate(
        input: {
          expressCheckout: $expressCheckout
          paymentMethod: $paymentMethod
          paymentSuccessUrl: $paymentSuccessUrl
          paymentFailureUrl: $paymentFailureUrl
          paymentCancelUrl: $paymentCancelUrl
        }
      ) {
          paymentInitiate {
            id
            success
            message
            orderId
            status 
            gatewayOrderId 
            newCartToken 
            express 
          }
      }
  }
`;

// 这个不用了
export const CREATE_CHECKOUT_ORDER: TypedDocumentNode<CreateCheckoutOrderData> = gql`
  mutation CreateCheckoutOrder {
    createCheckoutOrder(
      input: {}
    ) {
      checkoutOrder {
        id
        orderId
        message
        success
        paymentTransactionId
      }
    }
  }
`;