type Query {
    channels(options: ChannelListOptions): ChannelList!
    channel(id: ID!): Channel
    activeChannel: Channel!
}

type Mutation {
    "Create a new Channel"
    createChannel(input: CreateChannelInput!): CreateChannelResult!

    "Update an existing Channel"
    updateChannel(input: UpdateChannelInput!): UpdateChannelResult!

    "Delete a Channel"
    deleteChannel(id: ID!): DeletionResponse!

    "Delete multiple Channels"
    deleteChannels(ids: [ID!]!): [DeletionResponse!]!
}

type ChannelList implements PaginatedList {
    items: [Channel!]!
    totalItems: Int!
}

input ChannelListOptions

input CreateChannelInput {
    code: String!
    token: String!
    defaultLanguageCode: LanguageCode!
    availableLanguageCodes: [LanguageCode!]
    pricesIncludeTax: Boolean!
    currencyCode: CurrencyCode @deprecated(reason: "Use defaultCurrencyCode instead")
    defaultCurrencyCode: CurrencyCode
    availableCurrencyCodes: [CurrencyCode!]
    trackInventory: Boolean
    outOfStockThreshold: Int
    defaultTaxZoneId: ID!
    defaultShippingZoneId: ID!
    sellerId: ID
}

input UpdateChannelInput {
    id: ID!
    code: String
    token: String
    defaultLanguageCode: LanguageCode
    availableLanguageCodes: [LanguageCode!]
    pricesIncludeTax: Boolean
    currencyCode: CurrencyCode @deprecated(reason: "Use defaultCurrencyCode instead")
    defaultCurrencyCode: CurrencyCode
    availableCurrencyCodes: [CurrencyCode!]
    trackInventory: Boolean
    outOfStockThreshold: Int
    defaultTaxZoneId: ID
    defaultShippingZoneId: ID
    sellerId: ID
}

"Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings"
type LanguageNotAvailableError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
    languageCode: String!
}

union CreateChannelResult = Channel | LanguageNotAvailableError
union UpdateChannelResult = Channel | LanguageNotAvailableError
