# A monetary value with currency.
type MoneyV2 {
    # Decimal money amount.
    amount: Decimal!

    # Currency of the money.
    currencyCode: CurrencyCode!
}

# A collection of monetary values in their respective currencies. Typically used in the context of multi-currency pricing and transactions,
# when an amount in the shop's currency is converted to the customer's currency of choice (the presentment currency).
type MoneyBag {
    # Amount in presentment currency.
    presentmentMoney: MoneyV2!

    # Amount in shop currency.
    shopMoney: MoneyV2!
}

# Represents a price list, including information about related prices and eligibility rules.
# You can use price lists to specify either fixed prices or adjusted relative prices that
# override initial product variant prices. Price lists are applied to customers
# using context rules, which determine price list eligibility.
#
# For more information on price lists, refer to
# Support different pricing models.
type PriceList implements Node {
    # A set of facts about the customer, used to determine price list eligibility.
    contextRule: PriceListContextRule

    # The currency for fixed prices associated with this price list.
    currency: CurrencyCode!

    # A globally-unique identifier.
    id: ID!

    # The unique name of the price list, used as a human-readable identifier.
    name: String!

    # Relative adjustments to other prices.
    parent: PriceListParent

    # A list of prices associated with the price list.
    prices(
        originType: PriceListPriceOriginType
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
    ): PriceListPriceConnection!
}

# One type of value given to a customer when a discount is applied to an order.
# The application of a discount with this value gives the customer the specified percentage off a specified item.
type PricingPercentageValue {
    # The percentage value of the object.
    # This is a number between -100 (free) and 0 (no discount).
    percentage: Float!
}

# Represents information about pricing for a product variant
# as defined on a price list, such as the price, compare at price, and origin type.
# You can use a PriceListPrice to specify a fixed price for a specific product variant.
type PriceListPrice {
    # The compare-at price of the product variant on this price list.
    compareAtPrice: MoneyV2

    # The origin of a price, either fixed (defined on the price list) or relative (calculated using a price list adjustment configuration).
    originType: PriceListPriceOriginType!

    # The price of the product variant on this price list.
    price: MoneyV2!

    # The product variant associated with this price.
    variant: ProductVariant!
}

# Facts about the customer that was used to determine the price list eligibility.
# For example, if the PriceListContextRule is for a US market, then the price list will be eligible to all customers in the US.
# For more information on price lists, refer to
# Support different pricing models.
type PriceListContextRule {
    # A list of two letter country codes that determines price list eligibility.
    countries: [CountryCode!]!

    # The associated market.
    market: Market
}

# Represents relative adjustments from one price list to other prices.
# You can use a PriceListParent to specify an adjusted relative price using a percentage-based
# adjustment. Adjusted prices work in conjunction with exchange rules and rounding.
#
# Adjustment types
# support both percentage increases and decreases.
type PriceListParent {
    # A price list adjustment.
    adjustment: PriceListAdjustment!
}

# The type and value of a price list adjustment.
#
# For more information on price lists, refer to
# Support different pricing models.
type PriceListAdjustment {
    # The type of price adjustment, such as percentage increase or decrease.
    type: PriceListAdjustmentType!

    # The value of price adjustment, where positive numbers reduce the prices and negative numbers increase them.
    value: Float!
}

# Represents a single tax applied to the associated line item.
type TaxLine {
    # Whether the channel that submitted the tax line is liable for remitting. A value of null indicates unknown liability for this tax line.
    channelLiable: Boolean

    # The amount of tax, in shop and presentment currencies, after discounts and before returns.
    priceSet: MoneyBag!

    # The proportion of the line item price that the tax represents as a decimal.
    rate: Float

    # The proportion of the line item price that the tax represents as a percentage.
    ratePercentage: Float

    # The name of the tax.
    title: String!
}

# An amount that's allocated to a line based on an associated discount application.
type DiscountAllocation {
    # The money amount that's allocated to a line based on the associated discount application in shop and presentment currencies.
    allocatedAmountSet: MoneyBag!

    # The discount application that the allocated amount originated from.
    discountApplication: DiscountApplication!
}

# The pricing information about a subscription app.
# The object contains an interval (the frequency at which the shop is billed for an app subscription) and
# a price (the amount to be charged to the subscribing shop at each interval).
type AppRecurringPricing {
    # The discount applied to the subscription for a given number of billing intervals.
    discount: AppSubscriptionDiscount

    # The frequency at which the subscribing shop is billed for an app subscription.
    interval: AppPricingInterval!

    # The amount and currency to be charged to the subscribing shop every billing interval.
    price: MoneyV2!
}

# Discount applied to the recurring pricing portion of a subscription.
type AppSubscriptionDiscount {
    # The total number of billing intervals to which the discount will be applied.
    # The discount will be applied to an indefinite number of billing intervals if this value is blank.
    durationLimitInIntervals: Int

    # The price of the subscription after the discount is applied.
    priceAfterDiscount: MoneyV2!

    # The remaining number of billing intervals to which the discount will be applied.
    remainingDurationInIntervals: Int

    # The value of the discount applied every billing interval.
    value: AppSubscriptionDiscountValue!
}

# Defines a usage pricing model for the app subscription.
# These charges are variable based on how much the merchant uses the app.
type AppUsagePricing {
    # The total usage records for interval.
    balanceUsed: MoneyV2!

    # The capped amount prevents the merchant from being charged for any usage over that amount during a billing period.
    # This prevents billing from exceeding a maximum threshold over the duration of the billing period.
    # For the merchant to continue using the app after exceeding a capped amount, they would need to agree to a new usage charge.
    cappedAmount: MoneyV2!

    # The frequency with which the app usage records are billed.
    interval: AppPricingInterval!

    # The terms and conditions for app usage pricing.
    # Must be present in order to create usage charges.
    # The terms are presented to the merchant when they approve an app's usage charges.
    terms: String!
}

# The fixed amount value of a discount.
type AppSubscriptionDiscountAmount {
    # The fixed amount value of a discount.
    amount: MoneyV2!
}

# The percentage value of a discount.
type AppSubscriptionDiscountPercentage {
    # The percentage value of a discount.
    percentage: Float!
}

# The percentage value of a selling plan pricing policy percentage type.
type SellingPlanPricingPolicyPercentageValue {
    # The percentage value.
    percentage: Float!
}

# Represents an applied code discount.
type SubscriptionAppliedCodeDiscount {
    # The unique identifier.
    id: ID!

    # The redeem code of the discount that applies on the subscription.
    redeemCode: String!

    # The reason that the discount on the subscription draft is rejected.
    rejectionReason: SubscriptionDiscountRejectionReason
}

# The value of the discount and how it will be applied.
type SubscriptionDiscountFixedAmountValue {
    # The fixed amount value of the discount.
    amount: MoneyV2!

    # Whether the amount is applied per item.
    appliesOnEachItem: Boolean!
}

# The percentage value of the discount.
type SubscriptionDiscountPercentageValue {
    # The percentage value of the discount.
    percentage: Int!
}

# Represents a credit card payment instrument.
type VaultCreditCard {
    # The billing address of the card.
    billingAddress: CustomerCreditCardBillingAddress

    # The brand for the card.
    brand: String!

    # Whether the card has been expired.
    expired: Boolean!

    # The expiry month of the card.
    expiryMonth: Int!

    # The expiry year of the card.
    expiryYear: Int!

    # The last four digits for the card.
    lastDigits: String!

    # The name of the card holder.
    name: String!
}

# Represents a paypal billing agreement payment instrument.
type VaultPaypalBillingAgreement {
    # Whether the paypal billing agreement is inactive.
    inactive: Boolean!

    # The paypal account name.
    name: String!

    # The paypal account email address.
    paypalAccountEmail: String!
}

# An auto-generated type for paginating through multiple PriceListPrices.
type PriceListPriceConnection {
    # A list of edges.
    edges: [PriceListPriceEdge!]!

    # A list of the nodes contained in PriceListPriceEdge.
    nodes: [PriceListPrice!]!

    # Information to aid in pagination.
    pageInfo: PageInfo!
}

# An auto-generated type which holds one PriceListPrice and a cursor during pagination.
type PriceListPriceEdge {
    # A cursor for use in pagination.
    cursor: String!

    # The item at the end of PriceListPriceEdge.
    node: PriceListPrice!
}
