type Query {
    amPromoGetAvailableFreeGifts (
        cartId: String! @doc(description: "The unique ID that identifies the customer's cart")
    ): AvailableGifts @resolver(class: "Amasty\\PromoGraphql\\Model\\Resolver\\AvailableGifts")
}

type AvailableGifts {
    available_gifts_qty: Float @doc(description: "Available qty of gifts")
    promo_items: [PromoItem] @doc(description: "Free gift's data")
}

type PromoItem {
    sku: String @doc(description: "Gift's SKU")
    available_qty: Float @doc(description: "Available qty of current gift")
    price: Float @doc(description: "Gift's price with discount")
}

type Mutation {
    amPromoAddFreeGiftsToCart (
        cartId: String! @doc(description: "The unique ID that identifies the customer's cart")
        promoItems: [amPromoItemInput!] @doc(description: "An array that defines promo products to add to the cart.")
    ): AddGiftsToCartOutput! @resolver(class: "Amasty\\PromoGraphql\\Model\\Resolver\\AddFreeGifts")
}

input amPromoItemInput @doc(description: "Defines an promo product 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.")
    selected_options: [String!] @doc(description: "An array of strings corresponding to options the customer has selected.")
    entered_options: [EnteredOptionInput!] @doc(description: "An array of options the customer has entered.")
}

type AddGiftsToCartOutput @doc(description: "Contains details about the cart after adding products to it.") {
    cart: Cart! @doc(description: "The cart after products have been added.")
    user_errors: [String!]! @doc(description: "Contains errors encountered while adding an item to the cart.")
}
