# This file was auto-generated by Fern from our API Definition.

import typing_extensions
import typing_extensions
import typing
from ..types.order_line_item_discount_type import OrderLineItemDiscountType
from .money import MoneyParams
from ..types.order_line_item_discount_scope import OrderLineItemDiscountScope


class OrderReturnDiscountParams(typing_extensions.TypedDict):
    """
    Represents a discount being returned that applies to one or more return line items in an
    order.

    Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals.
    The amount distributed to each return line item is relative to that item’s contribution to the
    order subtotal.
    """

    uid: typing_extensions.NotRequired[typing.Optional[str]]
    """
    A unique ID that identifies the returned discount only within this order.
    """

    source_discount_uid: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The discount `uid` from the order that contains the original application of this discount.
    """

    catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The catalog object ID referencing [CatalogDiscount](entity:CatalogDiscount).
    """

    catalog_version: typing_extensions.NotRequired[typing.Optional[int]]
    """
    The version of the catalog object that this discount references.
    """

    name: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The discount's name.
    """

    type: typing_extensions.NotRequired[OrderLineItemDiscountType]
    """
    The type of the discount. If it is created by the API, it is `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
    
    Discounts that do not reference a catalog object ID must have a type of
    `FIXED_PERCENTAGE` or `FIXED_AMOUNT`.
    See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
    """

    percentage: typing_extensions.NotRequired[typing.Optional[str]]
    """
    The percentage of the tax, as a string representation of a decimal number.
    A value of `"7.25"` corresponds to a percentage of 7.25%.
    
    `percentage` is not set for amount-based discounts.
    """

    amount_money: typing_extensions.NotRequired[MoneyParams]
    """
    The total declared monetary amount of the discount.
    
    `amount_money` is not set for percentage-based discounts.
    """

    applied_money: typing_extensions.NotRequired[MoneyParams]
    """
    The amount of discount actually applied to this line item. When an amount-based
    discount is at the order level, this value is different from `amount_money` because the discount
    is distributed across the line items.
    """

    scope: typing_extensions.NotRequired[OrderLineItemDiscountScope]
    """
    Indicates the level at which the `OrderReturnDiscount` applies. For `ORDER` scoped
    discounts, the server generates references in `applied_discounts` on all
    `OrderReturnLineItem`s. For `LINE_ITEM` scoped discounts, the discount is only applied to
    `OrderReturnLineItem`s with references in their `applied_discounts` field.
    See [OrderLineItemDiscountScope](#type-orderlineitemdiscountscope) for possible values
    """
