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

enum GlobalFlag {
    TRUE
    FALSE
    INHERIT
}

enum AdjustmentType {
    TAX
    PROMOTION
    SHIPPING
    REFUND
    TAX_REFUND
    PROMOTION_REFUND
    SHIPPING_REFUND
}

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

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

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

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

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

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

# Populated at run-time
enum Permission {
    Placeholder
}

type DeletionResponse {
    result: DeletionResult!
    message: String
}

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

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

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

interface Node {
    id: ID!
}

enum SortOrder {
    ASC
    DESC
}

enum ErrorCode {
    UNKNOWN_ERROR
}

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

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
}

enum LogicalOperator {
    AND
    OR
}

input SearchInput {
    term: String
    facetValueIds: [ID!]
    facetValueOperator: LogicalOperator
    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!
}

"Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured."
type NativeAuthStrategyError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
}

"Returned if the user authentication credentials are not valid"
type InvalidCredentialsError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
    authenticationError: String!
}

"Returned if there is an error in transitioning the Order state"
type OrderStateTransitionError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
    transitionError: String!
    fromState: String!
    toState: String!
}

"Retured when attemting to create a Customer with an email address already registered to an existing User."
type EmailAddressConflictError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
}
