# Third-party custom scalars
scalar JSON
scalar DateTime
scalar Upload

interface PaginatedList {
    items: [Node!]!
    totalItems: Int!
}

interface Node {
    id: ID!
}

interface ErrorResult {
    errorCode: ErrorCode!
    message: String!
}

type Adjustment {
    adjustmentSource: String!
    type: AdjustmentType!
    description: String!
    amount: Int!
}

type TaxLine {
    description: String!
    taxRate: Float!
}

type ConfigArg {
    name: String!
    value: String!
}

type ConfigArgDefinition {
    name: String!
    type: String!
    list: Boolean!
    required: Boolean!
    defaultValue: JSON
    label: String
    description: String
    ui: JSON
}

type ConfigurableOperation {
    code: String!
    args: [ConfigArg!]!
}

type ConfigurableOperationDefinition {
    code: String!
    args: [ConfigArgDefinition!]!
    description: String!
}


type DeletionResponse {
    result: DeletionResult!
    message: String
}

input ConfigArgInput {
    name: String!
    "A JSON stringified representation of the actual value"
    value: String!
}

input ConfigurableOperationInput {
    code: String!
    arguments: [ConfigArgInput!]!
}

"Operators for filtering on a String field"
input StringOperators {
    eq: String
    notEq: String
    contains: String
    notContains: String
    in: [String!]
    notIn: [String!]
    regex: String
}

"Operators for filtering on an ID field"
input IDOperators {
    eq: String
    notEq: String
    in: [String!]
    notIn: [String!]
}

"Operators for filtering on a Boolean field"
input BooleanOperators {
    eq: Boolean
}

input NumberRange {
    start: Float!
    end: Float!
}

"Operators for filtering on a Int or Float field"
input NumberOperators {
    eq: Float
    lt: Float
    lte: Float
    gt: Float
    gte: Float
    between: NumberRange
}

input DateRange {
    start: DateTime!
    end: DateTime!
}

"Operators for filtering on a DateTime field"
input DateOperators {
    eq: DateTime
    before: DateTime
    after: DateTime
    between: DateRange
}

"Operators for filtering on a list of String fields"
input StringListOperators {
    inList: String!
}

"Operators for filtering on a list of Number fields"
input NumberListOperators {
    inList: Float!
}

"Operators for filtering on a list of Boolean fields"
input BooleanListOperators {
    inList: Boolean!
}

"Operators for filtering on a list of ID fields"
input IDListOperators {
    inList: ID!
}

"Operators for filtering on a list of Date fields"
input DateListOperators {
    inList: DateTime!
}

"""
Used to construct boolean expressions for filtering search results
by FacetValue ID. Examples:

* ID=1 OR ID=2: `{ facetValueFilters: [{ or: [1,2] }] }`
* ID=1 AND ID=2: `{ facetValueFilters: [{ and: 1 }, { and: 2 }] }`
* ID=1 AND (ID=2 OR ID=3): `{ facetValueFilters: [{ and: 1 }, { or: [2,3] }] }`
"""
input FacetValueFilterInput {
    and: ID
    or: [ID!]
}

input SearchInput {
    term: String
    facetValueIds: [ID!] @deprecated(reason: "Use `facetValueFilters` instead")
    facetValueOperator: LogicalOperator @deprecated(reason: "Use `facetValueFilters` instead")
    facetValueFilters: [FacetValueFilterInput!]
    collectionId: ID
    collectionSlug: String
    groupByProduct: Boolean
    take: Int
    skip: Int
    sort: SearchResultSortParameter
}

input SearchResultSortParameter {
    name: SortOrder
    price: SortOrder
}

input CreateCustomerInput {
    title: String
    firstName: String!
    lastName: String!
    phoneNumber: String
    emailAddress: String!
}

input CreateAddressInput {
    fullName: String
    company: String
    streetLine1: String!
    streetLine2: String
    city: String
    province: String
    postalCode: String
    countryCode: String!
    phoneNumber: String
    defaultShippingAddress: Boolean
    defaultBillingAddress: Boolean
}

input UpdateAddressInput {
    id: ID!
    fullName: String
    company: String
    streetLine1: String
    streetLine2: String
    city: String
    province: String
    postalCode: String
    countryCode: String
    phoneNumber: String
    defaultShippingAddress: Boolean
    defaultBillingAddress: Boolean
}

"""
Indicates that an operation succeeded, where we do not want to return any more specific information.
"""
type Success {
    success: Boolean!
}

type ShippingMethodQuote {
    id: ID!
    price: Int!
    priceWithTax: Int!
    code: String!
    name: String!
    description: String!
    "Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult"
    metadata: JSON
}

type PaymentMethodQuote {
    id: ID!
    code: String!
    name: String!
    description: String!
    isEligible: Boolean!
    eligibilityMessage: String
}
