# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.

input ProductAttributeFilterInput {
    stock_status: FilterEqualTypeInput @doc(description: "Filter by product stock availability (IN_STOCK/OUT_OF_STOCK)")
}

type Mutation {
    createGuestCart(input: CreateGuestCartInput): CreateGuestCartOutput @doc(description: "Create a new shopping cart") @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateGuestCart")
    createEmptyCart(input: createEmptyCartInput @doc(description: "An optional input object that assigns the specified ID to the cart.")): String @deprecated(reason: "Use `Mutation.createGuestCart` or `Query.customerCart` for logged in customer") @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CreateEmptyCart") @doc(description:"Create an empty shopping cart for a guest or logged in user")
    addSimpleProductsToCart(input: AddSimpleProductsToCartInput @doc(description: "An input object that defines which simple products to add to the cart.")): AddSimpleProductsToCartOutput @resolver(class: "Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") @doc(description:"Add one or more simple products to the specified cart. We recommend using `addProductsToCart` instead.")
    addVirtualProductsToCart(input: AddVirtualProductsToCartInput @doc(description: "An input object that defines which virtual products to add to the cart.")): AddVirtualProductsToCartOutput @resolver(class: "Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart") @doc(description:"Add one or more virtual products to the specified cart. We recommend using `addProductsToCart` instead.")
    applyCouponToCart(input: ApplyCouponToCartInput @doc(description: "An input object that defines the coupon code to apply to the cart.")): ApplyCouponToCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ApplyCouponToCart") @doc(description:"Apply a pre-defined coupon code to the specified cart.")
    removeCouponFromCart(input: RemoveCouponFromCartInput @doc(description: "An input object that defines which coupon code to remove from the cart.")): RemoveCouponFromCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\RemoveCouponFromCart") @doc(description:"Remove a previously-applied coupon from the cart. The cart must contain at least one item in order to remove the coupon.")
    updateCartItems(input: UpdateCartItemsInput @doc(description: "An input object that defines products to be updated.")): UpdateCartItemsOutput @resolver(class: "Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\UpdateCartItems") @doc(description:"Modify items in the cart.")
    removeItemFromCart(input: RemoveItemFromCartInput @doc(description: "An input object that defines which products to remove from the cart.")): RemoveItemFromCartOutput @resolver(class: "Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\RemoveItemFromCart") @doc(description:"Delete the entire quantity of a specified item from the cart. If you remove all items from the cart, the cart continues to exist.")
    setShippingAddressesOnCart(input: SetShippingAddressesOnCartInput @doc(description: "An input object that defines one or more shipping addresses to be assigned to the cart.")): SetShippingAddressesOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingAddressesOnCart") @doc(description:"Set one or more shipping addresses on a specific cart.")
    setBillingAddressOnCart(input: SetBillingAddressOnCartInput @doc(description: "An input object that defines the billing address to be assigned to the cart.")): SetBillingAddressOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetBillingAddressOnCart") @doc(description:"Set the billing address on a specific cart.")
    setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput @doc(description: "An input object that applies one or more shipping methods to the cart.")): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart") @doc(description:"Set one or more delivery methods on a cart.")
    setPaymentMethodOnCart(input: SetPaymentMethodOnCartInput @doc(description: "An input object that defines which payment method to apply to the cart.")): SetPaymentMethodOnCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\SetPaymentMethodOnCart") @doc(description:"Apply a payment method to the cart.")
    setGuestEmailOnCart(input: SetGuestEmailOnCartInput @doc(description: "An input object that defines a guest email address.")): SetGuestEmailOnCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\SetGuestEmailOnCart") @doc(description:"Assign the email address of a guest to the cart.")
    setPaymentMethodAndPlaceOrder(input: SetPaymentMethodAndPlaceOrderInput): PlaceOrderOutput @deprecated(reason: "Should use setPaymentMethodOnCart and placeOrder mutations in single request.") @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetPaymentAndPlaceOrder") @doc(description:"Set the cart payment method and convert the cart into an order.")
    """phpcs:ignore Magento2.GraphQL.ValidArgumentName"""
    assignCustomerToGuestCart(cart_id: String!): Cart! @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AssignCustomerToGuestCart") @doc(description:"Assign a logged-in customer to the specified guest shopping cart.")
    """phpcs:ignore Magento2.GraphQL.ValidArgumentName"""
    mergeCarts(source_cart_id: String! @doc(description: "The guest's cart ID before they login."), destination_cart_id: String @doc(description: "The cart ID after the guest logs in.")): Cart! @doc(description:"Transfer the contents of a guest cart into the cart of a logged-in customer.") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\MergeCarts")
    placeOrder(input: PlaceOrderInput @doc(description: "An input object that defines the shopper's cart ID.")): PlaceOrderOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\PlaceOrder") @doc(description:"Convert the quote into an order.")
    addProductsToCart(cartId: String! @doc(description: "The cart ID of the shopper."), cartItems: [CartItemInput!]! @doc(description: "An array that defines the products to add to the cart.")): AddProductsToCartOutput @doc(description:"Add any type of product to the cart.") @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddProductsToCart")
    estimateTotals(input: EstimateTotalsInput! @doc(description: "An input object that specifies details for cart totals estimation")): EstimateTotalsOutput! @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\EstimateTotals") @doc(description: "Estimate totals for cart based on the address")
    estimateShippingMethods(input: EstimateTotalsInput! @doc(description: "An input object that specifies details for estimation of available shipping methods")): [AvailableShippingMethod] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\EstimateShippingMethods") @doc(description: "Estimate shipping method(s) for cart based on address")
}

input AddSimpleProductsToCartInput @doc(description: "Defines the simple and group products to add to the cart.") {
    cart_id: String! @doc(description: "The unique ID of a `Cart` object.")
    cart_items: [SimpleProductCartItemInput!]! @doc(description: "An array of simple and group items to add.")
}

input SimpleProductCartItemInput @doc(description: "Defines a single product to add to the cart.") {
    data: CartItemInput! @doc(description: "An object containing the `sku`, `quantity`, and other relevant information about the product.")
    customizable_options:[CustomizableOptionInput!] @doc(description: "An array that defines customizable options for the product.")
}

input CartItemInput @doc(description: "Defines an item to be added to the cart.") {
    sku: String! @doc(description: "The SKU of the product.")
    quantity: Float! @doc(description: "The amount or number of an item to add.")
    quantityCategory: Float
    parent_sku: String @doc(description: "For a child product, the SKU of its parent product.")
    selected_options: [ID!] @doc(description: "The selected options for the base product, such as color or size, using the unique ID for an object such as `CustomizableRadioOption`, `CustomizableDropDownOption`, or `ConfigurableProductOptionsValues`.")
    entered_options: [EnteredOptionInput!] @doc(description: "An array of entered options for the base product, such as personalization text.")
    category_id: String @doc(description: "The selected category id")
    category_name: String @doc(description: "The selected category name")
}

type Cart @doc(description: "Contains the contents and other details about a guest or customer cart.") {
    id: ID! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\MaskedCartId") @doc(description: "The unique ID for a `Cart` object.")
    items: [CartItemInterface] @deprecated(reason: "Use `itemsV2` instead.") @resolver(class: "\\Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\CartItems") @doc(description: "An array of products that have been added to the cart.")
    itemsV2(pageSize: Int = 20, currentPage: Int = 1, sort: QuoteItemsSortInput): CartItems @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemsPaginated")
    applied_coupon: AppliedCoupon @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupon") @deprecated(reason: "Use `applied_coupons` instead.")
    applied_coupons: [AppliedCoupon] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupons") @doc(description:"An array of `AppliedCoupon` objects. Each object contains the `code` text attribute, which specifies the coupon code.")
    email: String @resolver (class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartEmail") @doc(description: "The email address of the guest or customer.")
    shipping_addresses: [ShippingCartAddress]! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\ShippingAddresses") @doc(description: "An array of shipping addresses assigned to the cart.")
    billing_address: BillingCartAddress @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\BillingAddress") @doc(description: "The billing address assigned to the cart.")
    available_payment_methods: [AvailablePaymentMethod] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AvailablePaymentMethods") @doc(description: "An array of available payment methods.")
    selected_payment_method: SelectedPaymentMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SelectedPaymentMethod") @doc(description: "Indicates which payment method was applied to the cart.")
    prices: CartPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartPrices") @doc(description: "Pricing details for the quote.")
    total_quantity: Float! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartTotalQuantity") @doc(description: "The total number of items in the cart.")
    is_virtual: Boolean! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartIsVirtual") @doc(description: "Indicates whether the cart contains only virtual products.")
}

input CartItemUpdateInput @doc(description: "A single item to be updated.") {
    cart_item_id: Int @doc(description: "Deprecated. Use `cart_item_uid` instead.")
    cart_item_uid: ID @doc(description: "The unique ID for a `CartItemInterface` object.")
    quantity: Float @doc(description: "The new quantity of the item.")
    category_id: String @doc(description: "The selected category id")
    customizable_options: [CustomizableOptionInput!] @doc(description: "An array that defines customizable options for the product.")
}

input RemoveItemFromCartInput @doc(description: "Specifies which items to remove from the cart.") {
    cart_id: String! @doc(description: "The unique ID of a `Cart` object.")
    cart_item_id: Int @doc(description: "Deprecated. Use `cart_item_uid` instead.")
    is_cart: Boolean
    category_id: String @doc(description: "The selected category id")
    cart_item_uid: ID @doc(description: "Required field. The unique ID for a `CartItemInterface` object.")
}

interface CartItemInterface @typeResolver(class: "Gti\\Overrides\\QuoteGraphQl\\Model\\Resolver\\CartItemTypeResolver") @doc(description: "An interface for products in a cart.") {
    id: String! @deprecated(reason: "Use `uid` instead.")
    uid: ID! @doc(description: "The unique ID for a `CartItemInterface` object.")
    quantity: Float! @doc(description: "The quantity of this item in the cart.")
    is_available: Boolean! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CheckProductStockAvailability") @doc(description: "True if requested quantity is less than available stock, false otherwise.")
    prices: CartItemPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemPrices") @doc(description: "Contains details about the price of the item, including taxes and discounts.")
    product: ProductInterface! @doc(description: "Details about an item in the cart.")
    category: String
    errors: [CartItemError!] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItemErrors") @doc(description: "An array of errors encountered while loading the cart item")
}
