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!
}

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

input ChannelListOptions

input CreateChannelInput {
    code: String!
    token: String!
    defaultLanguageCode: LanguageCode!
    pricesIncludeTax: Boolean!
    currencyCode: CurrencyCode!
    defaultTaxZoneId: ID!
    defaultShippingZoneId: ID!
    sellerId: ID
}

input UpdateChannelInput {
    id: ID!
    code: String
    token: String
    defaultLanguageCode: LanguageCode
    pricesIncludeTax: Boolean
    currencyCode: CurrencyCode
    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
