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

type ComparableItem {
    uid: ID! @doc(description: "The unique ID of an item in a compare list")
    product: ProductInterface! @doc(description: "Contains details about a product in a compare list")
    attributes: [ProductAttribute]! @doc(description: "An array of product attributes that can be used to compare products")
}

type ProductAttribute {
    code: String! @doc(description: "The unique identifier for a product attribute code.")
    value: String! @doc(description:"The display value of the attribute")
}

type ComparableAttribute {
    code: String! @doc(description: "An attribute code that is enabled for product comparisons")
    label: String! @doc(description: "The label of the attribute code")
}

type CompareList {
    uid: ID! @doc(description: "The unique ID assigned to the compare list")
    items: [ComparableItem] @doc(description: "An array of products to compare")
    attributes: [ComparableAttribute] @doc(description: "An array of attributes that can be used for comparing products")
    item_count: Int! @doc(description: "The number of items in the compare list")
}

type Customer {
    compare_list: CompareList @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\CustomerCompareList") @doc(description: "The contents of the customer's compare list")
}

type Query {
    compareList(uid: ID!): CompareList @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\CompareList") @doc(description: "Return products that have been added to the specified compare list")
}

type Mutation {
    createCompareList(input: CreateCompareListInput): CompareList @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\CreateCompareList") @doc(description: "Creates a new compare list. The compare list is saved for logged in customers")
    addProductsToCompareList(input: AddProductsToCompareListInput): CompareList @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\AddProductsToCompareList") @doc(description: "Add products to the specified compare list")
    removeProductsFromCompareList(input: RemoveProductsFromCompareListInput): CompareList @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\RemoveProductsFromCompareList") @doc(description: "Remove products from the specified compare list")
    assignCompareListToCustomer(uid: ID!): AssignCompareListToCustomerOutput @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\AssignCompareListToCustomer") @doc(description: "Assign the specified compare list to the logged in customer")
    deleteCompareList(uid: ID!): DeleteCompareListOutput @resolver(class: "\\Magento\\CompareListGraphQl\\Model\\Resolver\\DeleteCompareList") @doc(description: "Delete the specified compare list")
}

input CreateCompareListInput {
    products: [ID!] @doc(description: "An array of product IDs to add to the compare list")
}

input AddProductsToCompareListInput {
    uid: ID!, @doc(description: "The unique identifier of the compare list to modify")
    products: [ID!]! @doc(description: "An array of product IDs to add to the compare list")
}

input RemoveProductsFromCompareListInput {
    uid: ID!, @doc(description: "The unique identifier of the compare list to modify")
    products: [ID!]! @doc(description: "An array of product IDs to remove from the compare list")
}

type DeleteCompareListOutput {
    result: Boolean! @doc(description: "Indicates whether the compare list was successfully deleted")
}

type AssignCompareListToCustomerOutput {
    result: Boolean!
    compare_list: CompareList @doc(description: "The contents of the customer's compare list")
}
