type Query {
    promotion(id: ID!): Promotion
    promotions(options: PromotionListOptions): PromotionList!
    promotionConditions: [ConfigurableOperationDefinition!]!
    promotionActions: [ConfigurableOperationDefinition!]!
}

type Mutation {
    createPromotion(input: CreatePromotionInput!): CreatePromotionResult!
    updatePromotion(input: UpdatePromotionInput!): UpdatePromotionResult!
    deletePromotion(id: ID!): DeletionResponse!
    deletePromotions(ids: [ID!]!): [DeletionResponse!]!
    "Assigns Promotions to the specified Channel"
    assignPromotionsToChannel(input: AssignPromotionsToChannelInput!): [Promotion!]!
    "Removes Promotions from the specified Channel"
    removePromotionsFromChannel(input: RemovePromotionsFromChannelInput!): [Promotion!]!
}

# generated by generateListOptions function
input PromotionListOptions

input PromotionTranslationInput {
    id: ID
    languageCode: LanguageCode!
    name: String
    description: String
}
input CreatePromotionInput {
    enabled: Boolean!
    startsAt: DateTime
    endsAt: DateTime
    couponCode: String
    perCustomerUsageLimit: Int
    usageLimit: Int
    conditions: [ConfigurableOperationInput!]!
    actions: [ConfigurableOperationInput!]!
    translations: [PromotionTranslationInput!]!
}

input UpdatePromotionInput {
    id: ID!
    enabled: Boolean
    startsAt: DateTime
    endsAt: DateTime
    couponCode: String
    perCustomerUsageLimit: Int
    usageLimit: Int
    conditions: [ConfigurableOperationInput!]
    actions: [ConfigurableOperationInput!]
    translations: [PromotionTranslationInput!]
}

input AssignPromotionsToChannelInput {
    promotionIds: [ID!]!
    channelId: ID!
}

input RemovePromotionsFromChannelInput {
    promotionIds: [ID!]!
    channelId: ID!
}

"Returned if a PromotionCondition has neither a couponCode nor any conditions set"
type MissingConditionsError implements ErrorResult {
    errorCode: ErrorCode!
    message: String!
}

union CreatePromotionResult = Promotion | MissingConditionsError
union UpdatePromotionResult = Promotion | MissingConditionsError
