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

enum AdjustmentType {
    TAX
    PROMOTION
    SHIPPING
    REFUND
    TAX_REFUND
    PROMOTION_REFUND
    SHIPPING_REFUND
}

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

"""
Certain entities allow arbitrary configuration arguments to be specified which can then
be set in the admin-ui and used in the business logic of the app. These are the valid
data types of such arguments. The data type influences:

1. How the argument form field is rendered in the admin-ui
2. The JavaScript type into which the value is coerced before being passed to the business logic.

"""
enum ConfigArgType {
    PERCENTAGE
    MONEY
    INT
    STRING
    DATETIME
    BOOLEAN
    FACET_VALUE_IDS
}

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

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

enum DeletionResult {
    "The entity was successfully deleted"
    DELETED
    "Deletion did not take place, reason given in message"
    NOT_DELETED
}

type DeletionResponse {
    result: DeletionResult!
    message: String
}

input ConfigArgInput {
    name: String!
    type: ConfigArgType!
    value: String
}

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

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

interface Node {
    id: ID!
}

enum SortOrder {
    ASC
    DESC
}

input StringOperators {
    eq: String
    contains: String
}

input BooleanOperators {
    eq: Boolean
}

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

input NumberOperators {
    eq: Float
    lt: Float
    lte: Float
    gt: Float
    gte: Float
    between: NumberRange
}

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

input DateOperators {
    eq: DateTime
    before: DateTime
    after: DateTime
    between: DateRange
}

input SearchInput {
    term: String
    facetIds: [String!]
    collectionId: 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
}
