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

# generated by generateListOptions function
input PromotionListOptions

input CreatePromotionInput {
    name: String!
    enabled: Boolean!
    startsAt: DateTime
    endsAt: DateTime
    couponCode: String
    perCustomerUsageLimit: Int
    conditions: [ConfigurableOperationInput!]!
    actions: [ConfigurableOperationInput!]!
}

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

"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
