# Generated by ariadne-codegen
# Source: operations.graphql

from typing import Annotated, Any, List, Literal, Optional, Union

from stigg._vendors.pydantic import Field

from .base_model import BaseModel
from .enums import (
    AccessDeniedReason,
    Alignment,
    BillingCadence,
    BillingModel,
    BillingPeriod,
    BillingVendorIdentifier,
    CouponStatus,
    CouponType,
    Currency,
    DiscountDurationType,
    DiscountType,
    EntitlementResetPeriod,
    FeatureType,
    FontWeight,
    InvoiceLineItemType,
    MeterType,
    MonthlyAccordingTo,
    PaymentCollection,
    PaymentCollectionMethod,
    PaymentMethodType,
    PlanChangeType,
    PricingType,
    PromotionalEntitlementPeriod,
    PromotionalEntitlementStatus,
    ProvisionSubscriptionStatus,
    PublishMigrationType,
    SubscriptionDecisionStrategy,
    SubscriptionInvoiceBillingReason,
    SubscriptionInvoiceStatus,
    SubscriptionScheduleStatus,
    SubscriptionScheduleType,
    SubscriptionStatus,
    SyncStatus,
    TiersMode,
    TrialEndBehavior,
    TrialPeriodUnits,
    UnitTransformationRound,
    UsageMarkerType,
    VendorIdentifier,
    WeeklyAccordingTo,
    WidgetType,
    YearlyAccordingTo,
    experimentGroupType,
)


class AddonDependencyFragment(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)


class PriceTierFragment(BaseModel):
    up_to: Optional[float] = Field(alias="upTo", default=None)
    unit_price: Optional["PriceTierFragmentUnitPrice"] = Field(
        alias="unitPrice", default=None
    )
    flat_price: Optional["PriceTierFragmentFlatPrice"] = Field(
        alias="flatPrice", default=None
    )


class PriceTierFragmentUnitPrice(BaseModel):
    amount: float
    currency: Currency


class PriceTierFragmentFlatPrice(BaseModel):
    amount: float
    currency: Currency


class OveragePriceFragment(BaseModel):
    billing_model: BillingModel = Field(alias="billingModel")
    billing_period: BillingPeriod = Field(alias="billingPeriod")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    billing_country_code: Optional[str] = Field(
        alias="billingCountryCode", default=None
    )
    price: Optional["OveragePriceFragmentPrice"] = Field(default=None)
    tiers_mode: Optional[TiersMode] = Field(alias="tiersMode", default=None)
    tiers: Optional[List["OveragePriceFragmentTiers"]] = Field(default=None)
    feature: Optional["OveragePriceFragmentFeature"] = Field(default=None)


class OveragePriceFragmentPrice(BaseModel):
    amount: float
    currency: Currency


class OveragePriceFragmentTiers(PriceTierFragment):
    pass


class OveragePriceFragmentFeature(BaseModel):
    ref_id: str = Field(alias="refId")
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)


class PriceFragment(BaseModel):
    billing_model: BillingModel = Field(alias="billingModel")
    billing_period: BillingPeriod = Field(alias="billingPeriod")
    billing_cadence: BillingCadence = Field(alias="billingCadence")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    min_unit_quantity: Optional[float] = Field(alias="minUnitQuantity", default=None)
    max_unit_quantity: Optional[float] = Field(alias="maxUnitQuantity", default=None)
    billing_country_code: Optional[str] = Field(
        alias="billingCountryCode", default=None
    )
    price: Optional["PriceFragmentPrice"] = Field(default=None)
    credit_rate: Optional["PriceFragmentCreditRate"] = Field(
        alias="creditRate", default=None
    )
    tiers_mode: Optional[TiersMode] = Field(alias="tiersMode", default=None)
    tiers: Optional[List["PriceFragmentTiers"]] = Field(default=None)
    feature: Optional["PriceFragmentFeature"] = Field(default=None)
    block_size: Optional[float] = Field(alias="blockSize", default=None)


class PriceFragmentPrice(BaseModel):
    amount: float
    currency: Currency


class PriceFragmentCreditRate(BaseModel):
    amount: float
    custom_currency_id: Any = Field(alias="customCurrencyId")


class PriceFragmentTiers(PriceTierFragment):
    pass


class PriceFragmentFeature(BaseModel):
    ref_id: str = Field(alias="refId")
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)


class PackageEntitlementFragment(BaseModel):
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    has_unlimited_usage: Optional[bool] = Field(alias="hasUnlimitedUsage", default=None)
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    feature_id: str = Field(alias="featureId")
    reset_period: Optional[EntitlementResetPeriod] = Field(
        alias="resetPeriod", default=None
    )
    hidden_from_widgets: Optional[List[WidgetType]] = Field(
        alias="hiddenFromWidgets", default=None
    )
    is_custom: Optional[bool] = Field(alias="isCustom", default=None)
    display_name_override: Optional[str] = Field(
        alias="displayNameOverride", default=None
    )
    enum_values: Optional[List[str]] = Field(alias="enumValues", default=None)
    feature: "PackageEntitlementFragmentFeature"


class PackageEntitlementFragmentFeature(BaseModel):
    feature_type: FeatureType = Field(alias="featureType")
    meter_type: Optional[MeterType] = Field(alias="meterType", default=None)
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    ref_id: str = Field(alias="refId")
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )


class AddonFragment(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    hidden_from_widgets: Optional[List[WidgetType]] = Field(
        alias="hiddenFromWidgets", default=None
    )
    entitlements: Optional[List["AddonFragmentEntitlements"]] = Field(default=None)
    prices: Optional[List["AddonFragmentPrices"]] = Field(default=None)
    overage_prices: Optional[List["AddonFragmentOveragePrices"]] = Field(
        alias="overagePrices", default=None
    )
    pricing_type: Optional[PricingType] = Field(alias="pricingType", default=None)
    max_quantity: Optional[float] = Field(alias="maxQuantity", default=None)
    dependencies: Optional[List["AddonFragmentDependencies"]] = Field(default=None)


class AddonFragmentEntitlements(PackageEntitlementFragment):
    pass


class AddonFragmentPrices(PriceFragment):
    pass


class AddonFragmentOveragePrices(OveragePriceFragment):
    pass


class AddonFragmentDependencies(AddonDependencyFragment):
    pass


class SlimCustomerFragment(BaseModel):
    id: Any
    name: Optional[str] = Field(default=None)
    email: Optional[str] = Field(default=None)
    created_at: Optional[Any] = Field(alias="createdAt", default=None)
    updated_at: Any = Field(alias="updatedAt")
    ref_id: str = Field(alias="refId")
    customer_id: str = Field(alias="customerId")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    aws_marketplace_customer_id: Optional[str] = Field(
        alias="awsMarketplaceCustomerId", default=None
    )


class SubscriptionFutureUpdateData(BaseModel):
    subscription_schedule_type: SubscriptionScheduleType = Field(
        alias="subscriptionScheduleType"
    )
    schedule_status: SubscriptionScheduleStatus = Field(alias="scheduleStatus")
    scheduled_execution_time: Any = Field(alias="scheduledExecutionTime")
    target_package: Optional["SubscriptionFutureUpdateDataTargetPackage"] = Field(
        alias="targetPackage", default=None
    )
    schedule_variables: Optional[
        Annotated[
            Union[
                "SubscriptionFutureUpdateDataScheduleVariablesAddonChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesAddonPriceOverrideChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesBillingPeriodChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesCouponChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesPlanPriceOverrideChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables", default=None)


class SubscriptionFutureUpdateDataTargetPackage(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")


class SubscriptionFutureUpdateDataScheduleVariablesAddonChangeVariables(BaseModel):
    typename__: Literal["AddonChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    new_quantity: float = Field(alias="newQuantity")


class SubscriptionFutureUpdateDataScheduleVariablesAddonPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["AddonPriceOverrideChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesBillingPeriodChangeVariables(
    BaseModel
):
    typename__: Literal["BillingPeriodChangeVariables"] = Field(alias="__typename")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesCouponChangeVariables(BaseModel):
    typename__: Literal["CouponChangeVariables"] = Field(alias="__typename")


class SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariables(BaseModel):
    typename__: Literal["DowngradeChangeVariables"] = Field(alias="__typename")
    downgrade_plan_ref_id: str = Field(alias="downgradePlanRefId")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesAddons"
        ]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesAddons(
    BaseModel
):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariables(BaseModel):
    typename__: Literal["PlanChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    change_type: PlanChangeType = Field(alias="changeType")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List["SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesAddons"]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesAddons(BaseModel):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesPlanPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["PlanPriceOverrideChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionFutureUpdateDataScheduleVariablesUnitAmountChangeVariables(BaseModel):
    typename__: Literal["UnitAmountChangeVariables"] = Field(alias="__typename")
    new_unit_amount: Optional[float] = Field(alias="newUnitAmount", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionScheduledUpdateData(BaseModel):
    subscription_schedule_type: SubscriptionScheduleType = Field(
        alias="subscriptionScheduleType"
    )
    schedule_status: SubscriptionScheduleStatus = Field(alias="scheduleStatus")
    scheduled_execution_time: Any = Field(alias="scheduledExecutionTime")
    target_package: Optional["SubscriptionScheduledUpdateDataTargetPackage"] = Field(
        alias="targetPackage", default=None
    )
    schedule_variables: Optional[
        Annotated[
            Union[
                "SubscriptionScheduledUpdateDataScheduleVariablesAddonChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesAddonPriceOverrideChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesBillingPeriodChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesCouponChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesPlanPriceOverrideChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables", default=None)


class SubscriptionScheduledUpdateDataTargetPackage(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")


class SubscriptionScheduledUpdateDataScheduleVariablesAddonChangeVariables(BaseModel):
    typename__: Literal["AddonChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    new_quantity: float = Field(alias="newQuantity")


class SubscriptionScheduledUpdateDataScheduleVariablesAddonPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["AddonPriceOverrideChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesBillingPeriodChangeVariables(
    BaseModel
):
    typename__: Literal["BillingPeriodChangeVariables"] = Field(alias="__typename")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesCouponChangeVariables(BaseModel):
    typename__: Literal["CouponChangeVariables"] = Field(alias="__typename")


class SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariables(
    BaseModel
):
    typename__: Literal["DowngradeChangeVariables"] = Field(alias="__typename")
    downgrade_plan_ref_id: str = Field(alias="downgradePlanRefId")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesAddons"
        ]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesAddons(
    BaseModel
):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariables(BaseModel):
    typename__: Literal["PlanChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    change_type: PlanChangeType = Field(alias="changeType")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesAddons"
        ]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesAddons(
    BaseModel
):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesPlanPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["PlanPriceOverrideChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionScheduledUpdateDataScheduleVariablesUnitAmountChangeVariables(
    BaseModel
):
    typename__: Literal["UnitAmountChangeVariables"] = Field(alias="__typename")
    new_unit_amount: Optional[float] = Field(alias="newUnitAmount", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class SubscriptionInvoiceFragment(BaseModel):
    billing_id: str = Field(alias="billingId")
    status: SubscriptionInvoiceStatus
    created_at: Any = Field(alias="createdAt")
    updated_at: Any = Field(alias="updatedAt")
    error_message: Optional[str] = Field(alias="errorMessage", default=None)
    requires_action: bool = Field(alias="requiresAction")
    payment_secret: Optional[str] = Field(alias="paymentSecret", default=None)
    payment_url: Optional[str] = Field(alias="paymentUrl", default=None)
    pdf_url: Optional[str] = Field(alias="pdfUrl", default=None)
    billing_reason: Optional[SubscriptionInvoiceBillingReason] = Field(
        alias="billingReason", default=None
    )
    currency: Optional[str] = Field(default=None)
    sub_total: Optional[float] = Field(alias="subTotal", default=None)
    sub_total_excluding_tax: Optional[float] = Field(
        alias="subTotalExcludingTax", default=None
    )
    total: Optional[float] = Field(default=None)
    total_excluding_tax: Optional[float] = Field(
        alias="totalExcludingTax", default=None
    )
    tax: Optional[float] = Field(default=None)
    amount_due: Optional[float] = Field(alias="amountDue", default=None)
    attempt_count: Optional[float] = Field(alias="attemptCount", default=None)


class TotalPriceFragment(BaseModel):
    sub_total: "TotalPriceFragmentSubTotal" = Field(alias="subTotal")
    total: "TotalPriceFragmentTotal"


class TotalPriceFragmentSubTotal(BaseModel):
    amount: float
    currency: Currency


class TotalPriceFragmentTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionTrialConfigurationFragment(BaseModel):
    trial_end_behavior: TrialEndBehavior = Field(alias="trialEndBehavior")


class ProductFragment(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: Optional[str] = Field(alias="displayName", default=None)
    description: Optional[str] = Field(default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    product_settings: "ProductFragmentProductSettings" = Field(alias="productSettings")


class ProductFragmentProductSettings(BaseModel):
    downgrade_plan: Optional["ProductFragmentProductSettingsDowngradePlan"] = Field(
        alias="downgradePlan", default=None
    )


class ProductFragmentProductSettingsDowngradePlan(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")


class PlanCompatiblePackageGroupsFragment(BaseModel):
    package_group_id: str = Field(alias="packageGroupId")
    display_name: str = Field(alias="displayName")
    addons: Optional[List["PlanCompatiblePackageGroupsFragmentAddons"]] = Field(
        default=None
    )
    options: "PlanCompatiblePackageGroupsFragmentOptions"


class PlanCompatiblePackageGroupsFragmentAddons(AddonFragment):
    pass


class PlanCompatiblePackageGroupsFragmentOptions(BaseModel):
    min_items: Optional[float] = Field(alias="minItems", default=None)
    free_items: Optional[float] = Field(alias="freeItems", default=None)


class PlanFragment(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    version_number: int = Field(alias="versionNumber")
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    hidden_from_widgets: Optional[List[WidgetType]] = Field(
        alias="hiddenFromWidgets", default=None
    )
    product: "PlanFragmentProduct"
    base_plan: Optional["PlanFragmentBasePlan"] = Field(alias="basePlan", default=None)
    entitlements: Optional[List["PlanFragmentEntitlements"]] = Field(default=None)
    inherited_entitlements: Optional[List["PlanFragmentInheritedEntitlements"]] = Field(
        alias="inheritedEntitlements", default=None
    )
    compatible_addons: Optional[List["PlanFragmentCompatibleAddons"]] = Field(
        alias="compatibleAddons", default=None
    )
    compatible_package_groups: Optional[
        List["PlanFragmentCompatiblePackageGroups"]
    ] = Field(alias="compatiblePackageGroups", default=None)
    prices: Optional[List["PlanFragmentPrices"]] = Field(default=None)
    overage_prices: Optional[List["PlanFragmentOveragePrices"]] = Field(
        alias="overagePrices", default=None
    )
    pricing_type: Optional[PricingType] = Field(alias="pricingType", default=None)
    default_trial_config: Optional["PlanFragmentDefaultTrialConfig"] = Field(
        alias="defaultTrialConfig", default=None
    )


class PlanFragmentProduct(ProductFragment):
    pass


class PlanFragmentBasePlan(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")


class PlanFragmentEntitlements(PackageEntitlementFragment):
    pass


class PlanFragmentInheritedEntitlements(PackageEntitlementFragment):
    pass


class PlanFragmentCompatibleAddons(AddonFragment):
    pass


class PlanFragmentCompatiblePackageGroups(PlanCompatiblePackageGroupsFragment):
    pass


class PlanFragmentPrices(PriceFragment):
    pass


class PlanFragmentOveragePrices(OveragePriceFragment):
    pass


class PlanFragmentDefaultTrialConfig(BaseModel):
    duration: float
    units: TrialPeriodUnits
    budget: Optional["PlanFragmentDefaultTrialConfigBudget"] = Field(default=None)
    trial_end_behavior: Optional[TrialEndBehavior] = Field(
        alias="trialEndBehavior", default=None
    )


class PlanFragmentDefaultTrialConfigBudget(BaseModel):
    limit: float


class CustomerResourceFragment(BaseModel):
    resource_id: str = Field(alias="resourceId")


class SubscriptionFragment(BaseModel):
    id: Any
    subscription_id: str = Field(alias="subscriptionId")
    paying_customer: Optional["SubscriptionFragmentPayingCustomer"] = Field(
        alias="payingCustomer", default=None
    )
    start_date: Any = Field(alias="startDate")
    end_date: Optional[Any] = Field(alias="endDate", default=None)
    trial_end_date: Optional[Any] = Field(alias="trialEndDate", default=None)
    cancellation_date: Optional[Any] = Field(alias="cancellationDate", default=None)
    effective_end_date: Optional[Any] = Field(alias="effectiveEndDate", default=None)
    status: SubscriptionStatus
    ref_id: str = Field(alias="refId")
    current_billing_period_end: Optional[Any] = Field(
        alias="currentBillingPeriodEnd", default=None
    )
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    billing_link_url: Optional[str] = Field(alias="billingLinkUrl", default=None)
    latest_invoice: Optional["SubscriptionFragmentLatestInvoice"] = Field(
        alias="latestInvoice", default=None
    )
    payment_collection: PaymentCollection = Field(alias="paymentCollection")
    payment_collection_method: Optional[PaymentCollectionMethod] = Field(
        alias="paymentCollectionMethod", default=None
    )
    billing_sync_error: Optional[str] = Field(alias="billingSyncError", default=None)
    resource: Optional["SubscriptionFragmentResource"] = Field(default=None)
    experiment_info: Optional["SubscriptionFragmentExperimentInfo"] = Field(
        alias="experimentInfo", default=None
    )
    prices: Optional[List["SubscriptionFragmentPrices"]] = Field(default=None)
    total_price: Optional["SubscriptionFragmentTotalPrice"] = Field(
        alias="totalPrice", default=None
    )
    pricing_type: PricingType = Field(alias="pricingType")
    plan: "SubscriptionFragmentPlan"
    addons: Optional[List["SubscriptionFragmentAddons"]] = Field(default=None)
    scheduled_updates: Optional[List["SubscriptionFragmentScheduledUpdates"]] = Field(
        alias="scheduledUpdates", default=None
    )
    future_updates: List["SubscriptionFragmentFutureUpdates"] = Field(
        alias="futureUpdates"
    )
    trial_configuration: Optional["SubscriptionFragmentTrialConfiguration"] = Field(
        alias="trialConfiguration", default=None
    )


class SubscriptionFragmentPayingCustomer(SlimCustomerFragment):
    pass


class SubscriptionFragmentLatestInvoice(SubscriptionInvoiceFragment):
    pass


class SubscriptionFragmentResource(CustomerResourceFragment):
    pass


class SubscriptionFragmentExperimentInfo(BaseModel):
    name: str
    group_type: experimentGroupType = Field(alias="groupType")
    group_name: str = Field(alias="groupName")
    id: str


class SubscriptionFragmentPrices(BaseModel):
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    price: Optional["SubscriptionFragmentPricesPrice"] = Field(default=None)


class SubscriptionFragmentPricesPrice(PriceFragment):
    pass


class SubscriptionFragmentTotalPrice(TotalPriceFragment):
    pass


class SubscriptionFragmentPlan(PlanFragment):
    pass


class SubscriptionFragmentAddons(BaseModel):
    id: Any
    quantity: float
    addon: "SubscriptionFragmentAddonsAddon"


class SubscriptionFragmentAddonsAddon(AddonFragment):
    pass


class SubscriptionFragmentScheduledUpdates(SubscriptionScheduledUpdateData):
    pass


class SubscriptionFragmentFutureUpdates(SubscriptionFutureUpdateData):
    pass


class SubscriptionFragmentTrialConfiguration(SubscriptionTrialConfigurationFragment):
    pass


class FeatureFragment(BaseModel):
    typename__: str = Field(alias="__typename")
    feature_type: FeatureType = Field(alias="featureType")
    meter_type: Optional[MeterType] = Field(alias="meterType", default=None)
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    description: Optional[str] = Field(default=None)
    display_name: str = Field(alias="displayName")
    ref_id: str = Field(alias="refId")
    unit_transformation: Optional["FeatureFragmentUnitTransformation"] = Field(
        alias="unitTransformation", default=None
    )


class FeatureFragmentUnitTransformation(BaseModel):
    divide: float
    round: UnitTransformationRound


class EntitlementFragment(BaseModel):
    typename__: str = Field(alias="__typename")
    is_granted: bool = Field(alias="isGranted")
    access_denied_reason: Optional[AccessDeniedReason] = Field(
        alias="accessDeniedReason", default=None
    )
    customer_id: Optional[str] = Field(alias="customerId", default=None)
    resource_id: Optional[str] = Field(alias="resourceId", default=None)
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    has_unlimited_usage: bool = Field(alias="hasUnlimitedUsage")
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    current_usage: Optional[float] = Field(alias="currentUsage", default=None)
    requested_usage: Optional[float] = Field(alias="requestedUsage", default=None)
    requested_values: Optional[List[str]] = Field(alias="requestedValues", default=None)
    enum_values: Optional[List[str]] = Field(alias="enumValues", default=None)
    entitlement_updated_at: Optional[Any] = Field(
        alias="entitlementUpdatedAt", default=None
    )
    usage_updated_at: Optional[Any] = Field(alias="usageUpdatedAt", default=None)
    usage_period_anchor: Optional[Any] = Field(alias="usagePeriodAnchor", default=None)
    usage_period_start: Optional[Any] = Field(alias="usagePeriodStart", default=None)
    usage_period_end: Optional[Any] = Field(alias="usagePeriodEnd", default=None)
    next_reset_date: Optional[Any] = Field(alias="nextResetDate", default=None)
    reset_period: Optional[EntitlementResetPeriod] = Field(
        alias="resetPeriod", default=None
    )
    reset_period_configuration: Optional[
        Annotated[
            Union[
                "EntitlementFragmentResetPeriodConfigurationMonthlyResetPeriodConfig",
                "EntitlementFragmentResetPeriodConfigurationWeeklyResetPeriodConfig",
                "EntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="resetPeriodConfiguration", default=None)
    feature: Optional["EntitlementFragmentFeature"] = Field(default=None)


class EntitlementFragmentResetPeriodConfigurationMonthlyResetPeriodConfig(BaseModel):
    typename__: Literal["MonthlyResetPeriodConfig"] = Field(alias="__typename")
    monthly_according_to: Optional[MonthlyAccordingTo] = Field(
        alias="monthlyAccordingTo", default=None
    )


class EntitlementFragmentResetPeriodConfigurationWeeklyResetPeriodConfig(BaseModel):
    typename__: Literal["WeeklyResetPeriodConfig"] = Field(alias="__typename")
    weekly_according_to: Optional[WeeklyAccordingTo] = Field(
        alias="weeklyAccordingTo", default=None
    )


class EntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig(BaseModel):
    typename__: Literal["YearlyResetPeriodConfig"] = Field(alias="__typename")
    yearly_according_to: Optional[YearlyAccordingTo] = Field(
        alias="yearlyAccordingTo", default=None
    )


class EntitlementFragmentFeature(FeatureFragment):
    pass


class ApplySubscriptionFragment(BaseModel):
    subscription: Optional["ApplySubscriptionFragmentSubscription"] = Field(
        default=None
    )
    entitlements: Optional[List["ApplySubscriptionFragmentEntitlements"]] = Field(
        default=None
    )


class ApplySubscriptionFragmentSubscription(SubscriptionFragment):
    pass


class ApplySubscriptionFragmentEntitlements(EntitlementFragment):
    pass


class FontVariantFragment(BaseModel):
    font_size: Optional[float] = Field(alias="fontSize", default=None)
    font_weight: Optional[FontWeight] = Field(alias="fontWeight", default=None)


class TypographyConfigurationFragment(BaseModel):
    font_family: Optional[str] = Field(alias="fontFamily", default=None)
    h_1: Optional["TypographyConfigurationFragmentH1"] = Field(alias="h1", default=None)
    h_2: Optional["TypographyConfigurationFragmentH2"] = Field(alias="h2", default=None)
    h_3: Optional["TypographyConfigurationFragmentH3"] = Field(alias="h3", default=None)
    body: Optional["TypographyConfigurationFragmentBody"] = Field(default=None)


class TypographyConfigurationFragmentH1(FontVariantFragment):
    pass


class TypographyConfigurationFragmentH2(FontVariantFragment):
    pass


class TypographyConfigurationFragmentH3(FontVariantFragment):
    pass


class TypographyConfigurationFragmentBody(FontVariantFragment):
    pass


class CheckoutConfigurationFragment(BaseModel):
    palette: Optional["CheckoutConfigurationFragmentPalette"] = Field(default=None)
    typography: Optional["CheckoutConfigurationFragmentTypography"] = Field(
        default=None
    )
    custom_css: Optional[str] = Field(alias="customCss", default=None)
    content: Optional["CheckoutConfigurationFragmentContent"] = Field(default=None)
    typename__: str = Field(alias="__typename")


class CheckoutConfigurationFragmentPalette(BaseModel):
    primary: Optional[str] = Field(default=None)
    text_color: Optional[str] = Field(alias="textColor", default=None)
    background_color: Optional[str] = Field(alias="backgroundColor", default=None)
    border_color: Optional[str] = Field(alias="borderColor", default=None)
    summary_background_color: Optional[str] = Field(
        alias="summaryBackgroundColor", default=None
    )
    typename__: Literal["CheckoutColorPalette"] = Field(alias="__typename")


class CheckoutConfigurationFragmentTypography(TypographyConfigurationFragment):
    typename__: Literal["TypographyConfiguration"] = Field(alias="__typename")


class CheckoutConfigurationFragmentContent(BaseModel):
    collect_phone_number: Optional[bool] = Field(
        alias="collectPhoneNumber", default=None
    )


class CouponFragment(BaseModel):
    id: Any
    discount_value: float = Field(alias="discountValue")
    percent_off: Optional[float] = Field(alias="percentOff", default=None)
    amounts_off: Optional[List["CouponFragmentAmountsOff"]] = Field(
        alias="amountsOff", default=None
    )
    type: CouponType
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    ref_id: str = Field(alias="refId")
    name: str
    description: Optional[str] = Field(default=None)
    created_at: Any = Field(alias="createdAt")
    updated_at: Any = Field(alias="updatedAt")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    billing_link_url: Optional[str] = Field(alias="billingLinkUrl", default=None)
    status: CouponStatus
    sync_states: Optional[List["CouponFragmentSyncStates"]] = Field(
        alias="syncStates", default=None
    )


class CouponFragmentAmountsOff(BaseModel):
    amount: float
    currency: Currency


class CouponFragmentSyncStates(BaseModel):
    vendor_identifier: VendorIdentifier = Field(alias="vendorIdentifier")
    status: SyncStatus


class PromotionalEntitlementFragment(BaseModel):
    status: PromotionalEntitlementStatus
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    feature_id: Any = Field(alias="featureId")
    has_unlimited_usage: Optional[bool] = Field(alias="hasUnlimitedUsage", default=None)
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    reset_period: Optional[EntitlementResetPeriod] = Field(
        alias="resetPeriod", default=None
    )
    end_date: Optional[Any] = Field(alias="endDate", default=None)
    is_visible: bool = Field(alias="isVisible")
    feature: "PromotionalEntitlementFragmentFeature"


class PromotionalEntitlementFragmentFeature(BaseModel):
    feature_type: FeatureType = Field(alias="featureType")
    meter_type: Optional[MeterType] = Field(alias="meterType", default=None)
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    ref_id: str = Field(alias="refId")
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )


class CustomerFragment(SlimCustomerFragment):
    has_payment_method: bool = Field(alias="hasPaymentMethod")
    has_active_subscription: bool = Field(alias="hasActiveSubscription")
    default_payment_expiration_month: Optional[int] = Field(
        alias="defaultPaymentExpirationMonth", default=None
    )
    default_payment_expiration_year: Optional[int] = Field(
        alias="defaultPaymentExpirationYear", default=None
    )
    default_payment_method_last_4_digits: Optional[str] = Field(
        alias="defaultPaymentMethodLast4Digits", default=None
    )
    default_payment_method_type: Optional[PaymentMethodType] = Field(
        alias="defaultPaymentMethodType", default=None
    )
    trialed_plans: Optional[List["CustomerFragmentTrialedPlans"]] = Field(
        alias="trialedPlans", default=None
    )
    experiment_info: Optional["CustomerFragmentExperimentInfo"] = Field(
        alias="experimentInfo", default=None
    )
    coupon: Optional["CustomerFragmentCoupon"] = Field(default=None)
    eligible_for_trial: Optional[List["CustomerFragmentEligibleForTrial"]] = Field(
        alias="eligibleForTrial", default=None
    )
    promotional_entitlements: List["CustomerFragmentPromotionalEntitlements"] = Field(
        alias="promotionalEntitlements"
    )


class CustomerFragmentTrialedPlans(BaseModel):
    product_id: Optional[str] = Field(alias="productId", default=None)
    product_ref_id: Optional[str] = Field(alias="productRefId", default=None)
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    plan_id: Optional[str] = Field(alias="planId", default=None)


class CustomerFragmentExperimentInfo(BaseModel):
    group_type: experimentGroupType = Field(alias="groupType")
    group_name: str = Field(alias="groupName")
    id: str
    name: str


class CustomerFragmentCoupon(CouponFragment):
    pass


class CustomerFragmentEligibleForTrial(BaseModel):
    product_id: Optional[str] = Field(alias="productId", default=None)
    product_ref_id: Optional[str] = Field(alias="productRefId", default=None)
    eligible: bool


class CustomerFragmentPromotionalEntitlements(PromotionalEntitlementFragment):
    pass


class CheckoutStateFragment(BaseModel):
    configuration: Optional["CheckoutStateFragmentConfiguration"] = Field(default=None)
    setup_secret: str = Field(alias="setupSecret")
    customer: "CheckoutStateFragmentCustomer"
    active_subscription: Optional["CheckoutStateFragmentActiveSubscription"] = Field(
        alias="activeSubscription", default=None
    )
    resource: Optional["CheckoutStateFragmentResource"] = Field(default=None)
    plan: "CheckoutStateFragmentPlan"
    billing_integration: "CheckoutStateFragmentBillingIntegration" = Field(
        alias="billingIntegration"
    )


class CheckoutStateFragmentConfiguration(CheckoutConfigurationFragment):
    pass


class CheckoutStateFragmentCustomer(CustomerFragment):
    pass


class CheckoutStateFragmentActiveSubscription(SubscriptionFragment):
    pass


class CheckoutStateFragmentResource(CustomerResourceFragment):
    pass


class CheckoutStateFragmentPlan(PlanFragment):
    pass


class CheckoutStateFragmentBillingIntegration(BaseModel):
    billing_identifier: BillingVendorIdentifier = Field(alias="billingIdentifier")
    credentials: "CheckoutStateFragmentBillingIntegrationCredentials"


class CheckoutStateFragmentBillingIntegrationCredentials(BaseModel):
    account_id: str = Field(alias="accountId")
    public_key: str = Field(alias="publicKey")


class CustomerPortalBillingInformationFragment(BaseModel):
    email: Optional[str] = Field(default=None)
    name: Optional[str] = Field(default=None)
    default_payment_method_last_4_digits: Optional[str] = Field(
        alias="defaultPaymentMethodLast4Digits", default=None
    )
    default_payment_method_id: Optional[str] = Field(
        alias="defaultPaymentMethodId", default=None
    )
    default_payment_expiration_month: Optional[int] = Field(
        alias="defaultPaymentExpirationMonth", default=None
    )
    default_payment_expiration_year: Optional[int] = Field(
        alias="defaultPaymentExpirationYear", default=None
    )
    default_payment_method_type: Optional[PaymentMethodType] = Field(
        alias="defaultPaymentMethodType", default=None
    )


class CustomerPortalConfigurationFragment(BaseModel):
    palette: Optional["CustomerPortalConfigurationFragmentPalette"] = Field(
        default=None
    )
    typography: Optional["CustomerPortalConfigurationFragmentTypography"] = Field(
        default=None
    )
    custom_css: Optional[str] = Field(alias="customCss", default=None)


class CustomerPortalConfigurationFragmentPalette(BaseModel):
    primary: Optional[str] = Field(default=None)
    text_color: Optional[str] = Field(alias="textColor", default=None)
    background_color: Optional[str] = Field(alias="backgroundColor", default=None)
    border_color: Optional[str] = Field(alias="borderColor", default=None)
    current_plan_background: Optional[str] = Field(
        alias="currentPlanBackground", default=None
    )
    icons_color: Optional[str] = Field(alias="iconsColor", default=None)
    paywall_background_color: Optional[str] = Field(
        alias="paywallBackgroundColor", default=None
    )


class CustomerPortalConfigurationFragmentTypography(TypographyConfigurationFragment):
    pass


class CustomerPortalEntitlementFragment(BaseModel):
    is_granted: bool = Field(alias="isGranted")
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    current_usage: Optional[float] = Field(alias="currentUsage", default=None)
    has_unlimited_usage: bool = Field(alias="hasUnlimitedUsage")
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    usage_period_start: Optional[Any] = Field(alias="usagePeriodStart", default=None)
    usage_period_end: Optional[Any] = Field(alias="usagePeriodEnd", default=None)
    next_reset_date: Optional[Any] = Field(alias="nextResetDate", default=None)
    reset_period: Optional[EntitlementResetPeriod] = Field(
        alias="resetPeriod", default=None
    )
    reset_period_configuration: Optional[
        Annotated[
            Union[
                "CustomerPortalEntitlementFragmentResetPeriodConfigurationMonthlyResetPeriodConfig",
                "CustomerPortalEntitlementFragmentResetPeriodConfigurationWeeklyResetPeriodConfig",
                "CustomerPortalEntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="resetPeriodConfiguration", default=None)
    feature: Optional["CustomerPortalEntitlementFragmentFeature"] = Field(default=None)


class CustomerPortalEntitlementFragmentResetPeriodConfigurationMonthlyResetPeriodConfig(
    BaseModel
):
    typename__: Literal["MonthlyResetPeriodConfig"] = Field(alias="__typename")
    monthly_according_to: Optional[MonthlyAccordingTo] = Field(
        alias="monthlyAccordingTo", default=None
    )


class CustomerPortalEntitlementFragmentResetPeriodConfigurationWeeklyResetPeriodConfig(
    BaseModel
):
    typename__: Literal["WeeklyResetPeriodConfig"] = Field(alias="__typename")
    weekly_according_to: Optional[WeeklyAccordingTo] = Field(
        alias="weeklyAccordingTo", default=None
    )


class CustomerPortalEntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig(
    BaseModel
):
    typename__: Literal["YearlyResetPeriodConfig"] = Field(alias="__typename")
    yearly_according_to: Optional[YearlyAccordingTo] = Field(
        alias="yearlyAccordingTo", default=None
    )


class CustomerPortalEntitlementFragmentFeature(FeatureFragment):
    pass


class CustomerPortalSubscriptionPriceFragment(BaseModel):
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billing_model: Optional[BillingModel] = Field(alias="billingModel", default=None)
    block_size: Optional[float] = Field(alias="blockSize", default=None)
    price: Optional["CustomerPortalSubscriptionPriceFragmentPrice"] = Field(
        default=None
    )
    credit_rate: Optional["CustomerPortalSubscriptionPriceFragmentCreditRate"] = Field(
        alias="creditRate", default=None
    )
    feature: Optional["CustomerPortalSubscriptionPriceFragmentFeature"] = Field(
        default=None
    )


class CustomerPortalSubscriptionPriceFragmentPrice(BaseModel):
    amount: float
    currency: Currency


class CustomerPortalSubscriptionPriceFragmentCreditRate(BaseModel):
    amount: float
    custom_currency_id: Any = Field(alias="customCurrencyId")


class CustomerPortalSubscriptionPriceFragmentFeature(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )


class CustomerPortalSubscriptionAddonFragment(BaseModel):
    addon_id: str = Field(alias="addonId")
    description: Optional[str] = Field(default=None)
    display_name: str = Field(alias="displayName")
    quantity: int


class CustomerPortalSubscriptionScheduledUpdateDataFragment(BaseModel):
    subscription_schedule_type: SubscriptionScheduleType = Field(
        alias="subscriptionScheduleType"
    )
    schedule_status: SubscriptionScheduleStatus = Field(alias="scheduleStatus")
    scheduled_execution_time: Any = Field(alias="scheduledExecutionTime")
    target_package: Optional[
        "CustomerPortalSubscriptionScheduledUpdateDataFragmentTargetPackage"
    ] = Field(alias="targetPackage", default=None)
    schedule_variables: Optional[
        Annotated[
            Union[
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesAddonChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesAddonPriceOverrideChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesBillingPeriodChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesCouponChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanPriceOverrideChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentTargetPackage(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    pricing_type: Optional[PricingType] = Field(alias="pricingType", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesAddonChangeVariables(
    BaseModel
):
    typename__: Literal["AddonChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    new_quantity: float = Field(alias="newQuantity")


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesAddonPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["AddonPriceOverrideChangeVariables"] = Field(alias="__typename")
    addon_ref_id: str = Field(alias="addonRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesBillingPeriodChangeVariables(
    BaseModel
):
    typename__: Literal["BillingPeriodChangeVariables"] = Field(alias="__typename")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesCouponChangeVariables(
    BaseModel
):
    typename__: Literal["CouponChangeVariables"] = Field(alias="__typename")


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariables(
    BaseModel
):
    typename__: Literal["DowngradeChangeVariables"] = Field(alias="__typename")
    downgrade_plan_ref_id: str = Field(alias="downgradePlanRefId")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesAddons"
        ]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesAddons(
    BaseModel
):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariables(
    BaseModel
):
    typename__: Literal["PlanChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    change_type: PlanChangeType = Field(alias="changeType")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billable_features: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures", default=None)
    addons: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesAddons"
        ]
    ] = Field(default=None)
    price_overrides: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesPriceOverrides"
        ]
    ] = Field(alias="priceOverrides", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesBillableFeatures(
    BaseModel
):
    feature_id: str = Field(alias="featureId")
    quantity: float


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesAddons(
    BaseModel
):
    addon_ref_id: str = Field(alias="addonRefId")
    quantity: float


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesPriceOverrides(
    BaseModel
):
    plan_ref_id: Optional[str] = Field(alias="planRefId", default=None)
    addon_ref_id: Optional[str] = Field(alias="addonRefId", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanPriceOverrideChangeVariables(
    BaseModel
):
    typename__: Literal["PlanPriceOverrideChangeVariables"] = Field(alias="__typename")
    plan_ref_id: str = Field(alias="planRefId")
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesUnitAmountChangeVariables(
    BaseModel
):
    typename__: Literal["UnitAmountChangeVariables"] = Field(alias="__typename")
    new_unit_amount: Optional[float] = Field(alias="newUnitAmount", default=None)
    feature_id: Optional[str] = Field(alias="featureId", default=None)


class CustomerPortalSubscriptionFragment(BaseModel):
    subscription_id: str = Field(alias="subscriptionId")
    plan_id: str = Field(alias="planId")
    plan_name: str = Field(alias="planName")
    pricing_type: PricingType = Field(alias="pricingType")
    prices: List["CustomerPortalSubscriptionFragmentPrices"]
    pricing: "CustomerPortalSubscriptionFragmentPricing"
    status: SubscriptionStatus
    trial_remaining_days: Optional[int] = Field(
        alias="trialRemainingDays", default=None
    )
    billing_period_range: Optional[
        "CustomerPortalSubscriptionFragmentBillingPeriodRange"
    ] = Field(alias="billingPeriodRange", default=None)
    total_price: Optional["CustomerPortalSubscriptionFragmentTotalPrice"] = Field(
        alias="totalPrice", default=None
    )
    addons: List["CustomerPortalSubscriptionFragmentAddons"]
    scheduled_updates: Optional[
        List["CustomerPortalSubscriptionFragmentScheduledUpdates"]
    ] = Field(alias="scheduledUpdates", default=None)


class CustomerPortalSubscriptionFragmentPrices(CustomerPortalSubscriptionPriceFragment):
    pass


class CustomerPortalSubscriptionFragmentPricing(BaseModel):
    unit_quantity: Optional[int] = Field(alias="unitQuantity", default=None)
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod", default=None)
    billing_model: Optional[BillingModel] = Field(alias="billingModel", default=None)
    pricing_type: PricingType = Field(alias="pricingType")
    usage_based_estimated_bill: Optional[float] = Field(
        alias="usageBasedEstimatedBill", default=None
    )
    price: Optional["CustomerPortalSubscriptionFragmentPricingPrice"] = Field(
        default=None
    )
    credit_rate: Optional[
        "CustomerPortalSubscriptionFragmentPricingCreditRate"
    ] = Field(alias="creditRate", default=None)
    feature: Optional["CustomerPortalSubscriptionFragmentPricingFeature"] = Field(
        default=None
    )


class CustomerPortalSubscriptionFragmentPricingPrice(BaseModel):
    amount: float
    currency: Currency


class CustomerPortalSubscriptionFragmentPricingCreditRate(BaseModel):
    amount: float
    custom_currency_id: Any = Field(alias="customCurrencyId")


class CustomerPortalSubscriptionFragmentPricingFeature(BaseModel):
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")


class CustomerPortalSubscriptionFragmentBillingPeriodRange(BaseModel):
    start: Optional[Any] = Field(default=None)
    end: Optional[Any] = Field(default=None)


class CustomerPortalSubscriptionFragmentTotalPrice(BaseModel):
    sub_total: "CustomerPortalSubscriptionFragmentTotalPriceSubTotal" = Field(
        alias="subTotal"
    )
    total: "CustomerPortalSubscriptionFragmentTotalPriceTotal"
    addons_total: "CustomerPortalSubscriptionFragmentTotalPriceAddonsTotal" = Field(
        alias="addonsTotal"
    )


class CustomerPortalSubscriptionFragmentTotalPriceSubTotal(BaseModel):
    amount: float
    currency: Currency


class CustomerPortalSubscriptionFragmentTotalPriceTotal(BaseModel):
    amount: float
    currency: Currency


class CustomerPortalSubscriptionFragmentTotalPriceAddonsTotal(BaseModel):
    amount: float
    currency: Currency


class CustomerPortalSubscriptionFragmentAddons(CustomerPortalSubscriptionAddonFragment):
    pass


class CustomerPortalSubscriptionFragmentScheduledUpdates(
    CustomerPortalSubscriptionScheduledUpdateDataFragment
):
    pass


class CustomerPortalPromotionalEntitlementFragment(BaseModel):
    display_name: str = Field(alias="displayName")
    has_unlimited_usage: Optional[bool] = Field(alias="hasUnlimitedUsage", default=None)
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    period: PromotionalEntitlementPeriod
    start_date: Any = Field(alias="startDate")
    end_date: Optional[Any] = Field(alias="endDate", default=None)


class CustomerPortalFragment(BaseModel):
    subscriptions: List["CustomerPortalFragmentSubscriptions"]
    entitlements: List["CustomerPortalFragmentEntitlements"]
    promotional_entitlements: List[
        "CustomerPortalFragmentPromotionalEntitlements"
    ] = Field(alias="promotionalEntitlements")
    billing_information: "CustomerPortalFragmentBillingInformation" = Field(
        alias="billingInformation"
    )
    show_watermark: bool = Field(alias="showWatermark")
    billing_portal_url: Optional[str] = Field(alias="billingPortalUrl", default=None)
    can_upgrade_subscription: bool = Field(alias="canUpgradeSubscription")
    configuration: Optional["CustomerPortalFragmentConfiguration"] = Field(default=None)
    resource: Optional["CustomerPortalFragmentResource"] = Field(default=None)


class CustomerPortalFragmentSubscriptions(CustomerPortalSubscriptionFragment):
    pass


class CustomerPortalFragmentEntitlements(CustomerPortalEntitlementFragment):
    pass


class CustomerPortalFragmentPromotionalEntitlements(
    CustomerPortalPromotionalEntitlementFragment
):
    pass


class CustomerPortalFragmentBillingInformation(
    CustomerPortalBillingInformationFragment
):
    pass


class CustomerPortalFragmentConfiguration(CustomerPortalConfigurationFragment):
    pass


class CustomerPortalFragmentResource(CustomerResourceFragment):
    pass


class CustomerStatisticsFragment(BaseModel):
    statistics: Optional["CustomerStatisticsFragmentStatistics"] = Field(default=None)


class CustomerStatisticsFragmentStatistics(BaseModel):
    active_subscriptions_by_pricing_type: List[
        "CustomerStatisticsFragmentStatisticsActiveSubscriptionsByPricingType"
    ] = Field(alias="activeSubscriptionsByPricingType")


class CustomerStatisticsFragmentStatisticsActiveSubscriptionsByPricingType(BaseModel):
    pricing_type: PricingType = Field(alias="pricingType")
    total_count: float = Field(alias="totalCount")


class CustomerWithSubscriptionsFragment(CustomerFragment):
    subscriptions: Optional[
        List["CustomerWithSubscriptionsFragmentSubscriptions"]
    ] = Field(default=None)


class CustomerWithSubscriptionsFragmentSubscriptions(SubscriptionFragment):
    pass


class UsageUpdatedFragment(BaseModel):
    customer_id: str = Field(alias="customerId")
    resource_id: Optional[str] = Field(alias="resourceId", default=None)
    feature_id: str = Field(alias="featureId")
    current_usage: float = Field(alias="currentUsage")
    usage_period_start: Optional[float] = Field(alias="usagePeriodStart", default=None)
    usage_period_end: Optional[float] = Field(alias="usagePeriodEnd", default=None)
    next_reset_date: Optional[float] = Field(alias="nextResetDate", default=None)


class EntitlementUsageUpdated(BaseModel):
    usage: "EntitlementUsageUpdatedUsage"
    entitlement: "EntitlementUsageUpdatedEntitlement"


class EntitlementUsageUpdatedUsage(UsageUpdatedFragment):
    pass


class EntitlementUsageUpdatedEntitlement(EntitlementFragment):
    pass


class EntitlementsUpdatedPayload(BaseModel):
    customer_id: str = Field(alias="customerId")
    resource_id: Optional[str] = Field(alias="resourceId", default=None)
    entitlements: List["EntitlementsUpdatedPayloadEntitlements"]


class EntitlementsUpdatedPayloadEntitlements(EntitlementFragment):
    pass


class ImmediateSubscriptionPreviewInvoiceFragment(BaseModel):
    total: "ImmediateSubscriptionPreviewInvoiceFragmentTotal"
    sub_total: "ImmediateSubscriptionPreviewInvoiceFragmentSubTotal" = Field(
        alias="subTotal"
    )
    total_excluding_tax: "ImmediateSubscriptionPreviewInvoiceFragmentTotalExcludingTax" = Field(
        alias="totalExcludingTax"
    )
    tax: Optional["ImmediateSubscriptionPreviewInvoiceFragmentTax"] = Field(
        default=None
    )
    discount: Optional["ImmediateSubscriptionPreviewInvoiceFragmentDiscount"] = Field(
        default=None
    )
    tax_details: Optional[
        "ImmediateSubscriptionPreviewInvoiceFragmentTaxDetails"
    ] = Field(alias="taxDetails", default=None)
    discount_details: Optional[
        "ImmediateSubscriptionPreviewInvoiceFragmentDiscountDetails"
    ] = Field(alias="discountDetails", default=None)
    credits: Optional["ImmediateSubscriptionPreviewInvoiceFragmentCredits"] = Field(
        default=None
    )
    proration: Optional["ImmediateSubscriptionPreviewInvoiceFragmentProration"] = Field(
        default=None
    )


class ImmediateSubscriptionPreviewInvoiceFragmentTotal(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentSubTotal(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentTax(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentDiscount(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentTaxDetails(BaseModel):
    display_name: str = Field(alias="displayName")
    percentage: float
    inclusive: bool


class ImmediateSubscriptionPreviewInvoiceFragmentDiscountDetails(BaseModel):
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths", default=None)


class ImmediateSubscriptionPreviewInvoiceFragmentCredits(BaseModel):
    initial: "ImmediateSubscriptionPreviewInvoiceFragmentCreditsInitial"
    used: "ImmediateSubscriptionPreviewInvoiceFragmentCreditsUsed"
    remaining: "ImmediateSubscriptionPreviewInvoiceFragmentCreditsRemaining"


class ImmediateSubscriptionPreviewInvoiceFragmentCreditsInitial(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentCreditsUsed(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentCreditsRemaining(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentProration(BaseModel):
    proration_date: Any = Field(alias="prorationDate")
    has_prorations: Optional[bool] = Field(alias="hasProrations", default=None)
    credit: "ImmediateSubscriptionPreviewInvoiceFragmentProrationCredit"
    debit: "ImmediateSubscriptionPreviewInvoiceFragmentProrationDebit"
    net_amount: "ImmediateSubscriptionPreviewInvoiceFragmentProrationNetAmount" = Field(
        alias="netAmount"
    )


class ImmediateSubscriptionPreviewInvoiceFragmentProrationCredit(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentProrationDebit(BaseModel):
    amount: float
    currency: Currency


class ImmediateSubscriptionPreviewInvoiceFragmentProrationNetAmount(BaseModel):
    amount: float
    currency: Currency


class LayoutConfigurationFragment(BaseModel):
    alignment: Optional[Alignment] = Field(default=None)
    plan_width: Optional[float] = Field(alias="planWidth", default=None)
    plan_margin: Optional[float] = Field(alias="planMargin", default=None)
    plan_padding: Optional[float] = Field(alias="planPadding", default=None)


class MockPaywallAddonDependencyFragment(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)


class MockPaywallPackageEntitlementFragment(BaseModel):
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    has_unlimited_usage: bool = Field(alias="hasUnlimitedUsage")
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    reset_period: Optional[EntitlementResetPeriod] = Field(
        alias="resetPeriod", default=None
    )
    hidden_from_widgets: Optional[List[WidgetType]] = Field(
        alias="hiddenFromWidgets", default=None
    )
    display_name_override: Optional[str] = Field(
        alias="displayNameOverride", default=None
    )
    enum_values: Optional[List[str]] = Field(alias="enumValues", default=None)
    feature: Optional["MockPaywallPackageEntitlementFragmentFeature"] = Field(
        default=None
    )


class MockPaywallPackageEntitlementFragmentFeature(BaseModel):
    feature_type: FeatureType = Field(alias="featureType")
    meter_type: Optional[MeterType] = Field(alias="meterType", default=None)
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    ref_id: str = Field(alias="refId")
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )


class MockPaywallPriceFragment(BaseModel):
    billing_model: BillingModel = Field(alias="billingModel")
    billing_period: BillingPeriod = Field(alias="billingPeriod")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    min_unit_quantity: Optional[float] = Field(alias="minUnitQuantity", default=None)
    max_unit_quantity: Optional[float] = Field(alias="maxUnitQuantity", default=None)
    billing_country_code: Optional[str] = Field(
        alias="billingCountryCode", default=None
    )
    price: Optional["MockPaywallPriceFragmentPrice"] = Field(default=None)
    credit_rate: Optional["MockPaywallPriceFragmentCreditRate"] = Field(
        alias="creditRate", default=None
    )
    tiers_mode: Optional[TiersMode] = Field(alias="tiersMode", default=None)
    tiers: Optional[List["MockPaywallPriceFragmentTiers"]] = Field(default=None)
    feature: Optional["MockPaywallPriceFragmentFeature"] = Field(default=None)
    block_size: Optional[float] = Field(alias="blockSize", default=None)


class MockPaywallPriceFragmentPrice(BaseModel):
    amount: float
    currency: Currency


class MockPaywallPriceFragmentCreditRate(BaseModel):
    amount: float
    custom_currency_id: Any = Field(alias="customCurrencyId")


class MockPaywallPriceFragmentTiers(PriceTierFragment):
    pass


class MockPaywallPriceFragmentFeature(BaseModel):
    ref_id: str = Field(alias="refId")
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")


class MockPaywallAddonFragment(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    max_quantity: Optional[float] = Field(alias="maxQuantity", default=None)
    hidden_from_widgets: Optional[List[WidgetType]] = Field(
        alias="hiddenFromWidgets", default=None
    )
    dependencies: Optional[List["MockPaywallAddonFragmentDependencies"]] = Field(
        default=None
    )
    entitlements: List["MockPaywallAddonFragmentEntitlements"]
    prices: List["MockPaywallAddonFragmentPrices"]
    pricing_type: Optional[PricingType] = Field(alias="pricingType", default=None)


class MockPaywallAddonFragmentDependencies(MockPaywallAddonDependencyFragment):
    pass


class MockPaywallAddonFragmentEntitlements(MockPaywallPackageEntitlementFragment):
    pass


class MockPaywallAddonFragmentPrices(MockPaywallPriceFragment):
    pass


class MockPaywallPlanCompatiblePackageGroupsFragment(BaseModel):
    package_group_id: str = Field(alias="packageGroupId")
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)
    addons: Optional[
        List["MockPaywallPlanCompatiblePackageGroupsFragmentAddons"]
    ] = Field(default=None)
    options: "MockPaywallPlanCompatiblePackageGroupsFragmentOptions"


class MockPaywallPlanCompatiblePackageGroupsFragmentAddons(MockPaywallAddonFragment):
    pass


class MockPaywallPlanCompatiblePackageGroupsFragmentOptions(BaseModel):
    min_items: Optional[float] = Field(alias="minItems", default=None)
    free_items: Optional[float] = Field(alias="freeItems", default=None)


class MockPaywallPlanFragment(BaseModel):
    ref_id: str = Field(alias="refId")
    description: Optional[str] = Field(default=None)
    display_name: str = Field(alias="displayName")
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    product: "MockPaywallPlanFragmentProduct"
    base_plan: Optional["MockPaywallPlanFragmentBasePlan"] = Field(
        alias="basePlan", default=None
    )
    entitlements: Optional[List["MockPaywallPlanFragmentEntitlements"]] = Field(
        default=None
    )
    inherited_entitlements: Optional[
        List["MockPaywallPlanFragmentInheritedEntitlements"]
    ] = Field(alias="inheritedEntitlements", default=None)
    prices: List["MockPaywallPlanFragmentPrices"]
    pricing_type: Optional[PricingType] = Field(alias="pricingType", default=None)
    default_trial_config: Optional["MockPaywallPlanFragmentDefaultTrialConfig"] = Field(
        alias="defaultTrialConfig", default=None
    )
    compatible_addons: Optional[
        List["MockPaywallPlanFragmentCompatibleAddons"]
    ] = Field(alias="compatibleAddons", default=None)
    compatible_package_groups: Optional[
        List["MockPaywallPlanFragmentCompatiblePackageGroups"]
    ] = Field(alias="compatiblePackageGroups", default=None)


class MockPaywallPlanFragmentProduct(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: Optional[str] = Field(alias="displayName", default=None)
    description: Optional[str] = Field(default=None)
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )


class MockPaywallPlanFragmentBasePlan(BaseModel):
    ref_id: str = Field(alias="refId")
    display_name: str = Field(alias="displayName")


class MockPaywallPlanFragmentEntitlements(MockPaywallPackageEntitlementFragment):
    pass


class MockPaywallPlanFragmentInheritedEntitlements(
    MockPaywallPackageEntitlementFragment
):
    pass


class MockPaywallPlanFragmentPrices(MockPaywallPriceFragment):
    pass


class MockPaywallPlanFragmentDefaultTrialConfig(BaseModel):
    duration: float
    units: TrialPeriodUnits
    budget: Optional["MockPaywallPlanFragmentDefaultTrialConfigBudget"] = Field(
        default=None
    )
    trial_end_behavior: Optional[TrialEndBehavior] = Field(
        alias="trialEndBehavior", default=None
    )


class MockPaywallPlanFragmentDefaultTrialConfigBudget(BaseModel):
    limit: float


class MockPaywallPlanFragmentCompatibleAddons(MockPaywallAddonFragment):
    pass


class MockPaywallPlanFragmentCompatiblePackageGroups(
    MockPaywallPlanCompatiblePackageGroupsFragment
):
    pass


class PackagePublishedPayload(BaseModel):
    account_id: str = Field(alias="accountId")
    environment_id: str = Field(alias="environmentId")
    package_type: str = Field(alias="packageType")
    package_ref_id: str = Field(alias="packageRefId")
    package_version: int = Field(alias="packageVersion")
    migration_type: PublishMigrationType = Field(alias="migrationType")


class PageInfoFragment(BaseModel):
    start_cursor: Optional[Any] = Field(alias="startCursor", default=None)
    end_cursor: Optional[Any] = Field(alias="endCursor", default=None)
    has_next_page: Optional[bool] = Field(alias="hasNextPage", default=None)
    has_previous_page: Optional[bool] = Field(alias="hasPreviousPage", default=None)


class PaywallCalculatedPricePointsFragment(BaseModel):
    plan_id: str = Field(alias="planId")
    additional_charges_may_apply: Optional[bool] = Field(
        alias="additionalChargesMayApply", default=None
    )
    billing_period: BillingPeriod = Field(alias="billingPeriod")
    amount: float
    currency: Currency
    billing_country_code: Optional[str] = Field(
        alias="billingCountryCode", default=None
    )
    feature: Optional["PaywallCalculatedPricePointsFragmentFeature"] = Field(
        default=None
    )


class PaywallCalculatedPricePointsFragmentFeature(BaseModel):
    ref_id: str = Field(alias="refId")
    feature_units: Optional[str] = Field(alias="featureUnits", default=None)
    feature_units_plural: Optional[str] = Field(
        alias="featureUnitsPlural", default=None
    )
    display_name: str = Field(alias="displayName")
    description: Optional[str] = Field(default=None)


class PaywallConfigurationFragment(BaseModel):
    palette: Optional["PaywallConfigurationFragmentPalette"] = Field(default=None)
    typography: Optional["PaywallConfigurationFragmentTypography"] = Field(default=None)
    layout: Optional["PaywallConfigurationFragmentLayout"] = Field(default=None)
    custom_css: Optional[str] = Field(alias="customCss", default=None)


class PaywallConfigurationFragmentPalette(BaseModel):
    primary: Optional[str] = Field(default=None)
    text_color: Optional[str] = Field(alias="textColor", default=None)
    background_color: Optional[str] = Field(alias="backgroundColor", default=None)
    border_color: Optional[str] = Field(alias="borderColor", default=None)
    current_plan_background: Optional[str] = Field(
        alias="currentPlanBackground", default=None
    )


class PaywallConfigurationFragmentTypography(TypographyConfigurationFragment):
    pass


class PaywallConfigurationFragmentLayout(LayoutConfigurationFragment):
    pass


class PaywallCurrencyFragment(BaseModel):
    code: Currency
    symbol: str


class PaywallFragment(BaseModel):
    plans: List["PaywallFragmentPlans"]
    currency: "PaywallFragmentCurrency"
    configuration: Optional["PaywallFragmentConfiguration"] = Field(default=None)
    customer: Optional["PaywallFragmentCustomer"] = Field(default=None)
    active_subscriptions: Optional[List["PaywallFragmentActiveSubscriptions"]] = Field(
        alias="activeSubscriptions", default=None
    )
    resource: Optional["PaywallFragmentResource"] = Field(default=None)
    paywall_calculated_price_points: Optional[
        List["PaywallFragmentPaywallCalculatedPricePoints"]
    ] = Field(alias="paywallCalculatedPricePoints", default=None)


class PaywallFragmentPlans(PlanFragment):
    pass


class PaywallFragmentCurrency(PaywallCurrencyFragment):
    pass


class PaywallFragmentConfiguration(PaywallConfigurationFragment):
    pass


class PaywallFragmentCustomer(CustomerFragment):
    pass


class PaywallFragmentActiveSubscriptions(SubscriptionFragment):
    pass


class PaywallFragmentResource(CustomerResourceFragment):
    pass


class PaywallFragmentPaywallCalculatedPricePoints(PaywallCalculatedPricePointsFragment):
    pass


class SlimSubscriptionFragment(BaseModel):
    id: Any
    subscription_id: str = Field(alias="subscriptionId")
    ref_id: str = Field(alias="refId")
    status: SubscriptionStatus
    additional_meta_data: Optional[Any] = Field(
        alias="additionalMetaData", default=None
    )
    billing_id: Optional[str] = Field(alias="billingId", default=None)
    billing_link_url: Optional[str] = Field(alias="billingLinkUrl", default=None)
    effective_end_date: Optional[Any] = Field(alias="effectiveEndDate", default=None)
    cancellation_date: Optional[Any] = Field(alias="cancellationDate", default=None)
    current_billing_period_end: Optional[Any] = Field(
        alias="currentBillingPeriodEnd", default=None
    )
    pricing_type: PricingType = Field(alias="pricingType")
    latest_invoice: Optional["SlimSubscriptionFragmentLatestInvoice"] = Field(
        alias="latestInvoice", default=None
    )
    payment_collection: PaymentCollection = Field(alias="paymentCollection")
    billing_sync_error: Optional[str] = Field(alias="billingSyncError", default=None)
    resource: Optional["SlimSubscriptionFragmentResource"] = Field(default=None)
    experiment_info: Optional["SlimSubscriptionFragmentExperimentInfo"] = Field(
        alias="experimentInfo", default=None
    )
    prices: Optional[List["SlimSubscriptionFragmentPrices"]] = Field(default=None)
    total_price: Optional["SlimSubscriptionFragmentTotalPrice"] = Field(
        alias="totalPrice", default=None
    )
    plan: "SlimSubscriptionFragmentPlan"
    addons: Optional[List["SlimSubscriptionFragmentAddons"]] = Field(default=None)
    customer: "SlimSubscriptionFragmentCustomer"


class SlimSubscriptionFragmentLatestInvoice(SubscriptionInvoiceFragment):
    pass


class SlimSubscriptionFragmentResource(CustomerResourceFragment):
    pass


class SlimSubscriptionFragmentExperimentInfo(BaseModel):
    name: str
    id: str
    group_type: experimentGroupType = Field(alias="groupType")
    group_name: str = Field(alias="groupName")


class SlimSubscriptionFragmentPrices(BaseModel):
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    price: Optional["SlimSubscriptionFragmentPricesPrice"] = Field(default=None)


class SlimSubscriptionFragmentPricesPrice(PriceFragment):
    pass


class SlimSubscriptionFragmentTotalPrice(TotalPriceFragment):
    pass


class SlimSubscriptionFragmentPlan(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")


class SlimSubscriptionFragmentAddons(BaseModel):
    quantity: float
    addon: "SlimSubscriptionFragmentAddonsAddon"


class SlimSubscriptionFragmentAddonsAddon(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")


class SlimSubscriptionFragmentCustomer(BaseModel):
    id: Any
    ref_id: str = Field(alias="refId")


class ProvisionCustomerFragment(BaseModel):
    customer: "ProvisionCustomerFragmentCustomer"
    subscription_decision_strategy: SubscriptionDecisionStrategy = Field(
        alias="subscriptionDecisionStrategy"
    )
    subscription: Optional["ProvisionCustomerFragmentSubscription"] = Field(
        default=None
    )
    entitlements: Optional[List["ProvisionCustomerFragmentEntitlements"]] = Field(
        default=None
    )


class ProvisionCustomerFragmentCustomer(SlimCustomerFragment):
    pass


class ProvisionCustomerFragmentSubscription(SlimSubscriptionFragment):
    pass


class ProvisionCustomerFragmentEntitlements(EntitlementFragment):
    pass


class ProvisionSubscriptionFragment(BaseModel):
    status: ProvisionSubscriptionStatus
    checkout_url: Optional[str] = Field(alias="checkoutUrl", default=None)
    checkout_billing_id: Optional[str] = Field(alias="checkoutBillingId", default=None)
    subscription: Optional["ProvisionSubscriptionFragmentSubscription"] = Field(
        default=None
    )
    entitlements: Optional[List["ProvisionSubscriptionFragmentEntitlements"]] = Field(
        default=None
    )


class ProvisionSubscriptionFragmentSubscription(SlimSubscriptionFragment):
    pass


class ProvisionSubscriptionFragmentEntitlements(EntitlementFragment):
    pass


class ReportUsageFragment(BaseModel):
    id: Any
    feature_id: str = Field(alias="featureId")
    customer_id: str = Field(alias="customerId")
    resource_id: Optional[str] = Field(alias="resourceId", default=None)
    current_usage: Optional[float] = Field(alias="currentUsage", default=None)
    usage_period_start: Optional[Any] = Field(alias="usagePeriodStart", default=None)
    usage_period_end: Optional[Any] = Field(alias="usagePeriodEnd", default=None)
    next_reset_date: Optional[Any] = Field(alias="nextResetDate", default=None)
    timestamp: Any


class SlimSubscriptionFragmentV2(BaseModel):
    subscription_id: str = Field(alias="subscriptionId")
    status: SubscriptionStatus
    pricing_type: PricingType = Field(alias="pricingType")
    start_date: Any = Field(alias="startDate")
    cancellation_date: Optional[Any] = Field(alias="cancellationDate", default=None)
    current_billing_period_end: Optional[Any] = Field(
        alias="currentBillingPeriodEnd", default=None
    )
    customer: "SlimSubscriptionFragmentV2Customer"
    paying_customer: Optional["SlimSubscriptionFragmentV2PayingCustomer"] = Field(
        alias="payingCustomer", default=None
    )
    resource: Optional["SlimSubscriptionFragmentV2Resource"] = Field(default=None)
    plan: "SlimSubscriptionFragmentV2Plan"
    addons: Optional[List["SlimSubscriptionFragmentV2Addons"]] = Field(default=None)
    trial_configuration: Optional[
        "SlimSubscriptionFragmentV2TrialConfiguration"
    ] = Field(alias="trialConfiguration", default=None)
    trial_end_date: Optional[Any] = Field(alias="trialEndDate", default=None)


class SlimSubscriptionFragmentV2Customer(BaseModel):
    customer_id: str = Field(alias="customerId")


class SlimSubscriptionFragmentV2PayingCustomer(BaseModel):
    customer_id: str = Field(alias="customerId")


class SlimSubscriptionFragmentV2Resource(BaseModel):
    resource_id: str = Field(alias="resourceId")


class SlimSubscriptionFragmentV2Plan(BaseModel):
    plan_id: str = Field(alias="planId")
    display_name: str = Field(alias="displayName")


class SlimSubscriptionFragmentV2Addons(BaseModel):
    quantity: float
    addon: "SlimSubscriptionFragmentV2AddonsAddon"


class SlimSubscriptionFragmentV2AddonsAddon(BaseModel):
    addon_id: str = Field(alias="addonId")


class SlimSubscriptionFragmentV2TrialConfiguration(BaseModel):
    trial_end_behavior: TrialEndBehavior = Field(alias="trialEndBehavior")


class SubscriptionInvoicePreviewFragment(BaseModel):
    amount_due: "SubscriptionInvoicePreviewFragmentAmountDue" = Field(alias="amountDue")
    minimum_spend_adjustment: "SubscriptionInvoicePreviewFragmentMinimumSpendAdjustment" = Field(
        alias="minimumSpendAdjustment"
    )
    total: "SubscriptionInvoicePreviewFragmentTotal"
    total_excluding_tax: "SubscriptionInvoicePreviewFragmentTotalExcludingTax" = Field(
        alias="totalExcludingTax"
    )
    sub_total: "SubscriptionInvoicePreviewFragmentSubTotal" = Field(alias="subTotal")
    sub_total_excluding_tax: "SubscriptionInvoicePreviewFragmentSubTotalExcludingTax" = Field(
        alias="subTotalExcludingTax"
    )
    tax: Optional["SubscriptionInvoicePreviewFragmentTax"] = Field(default=None)
    tax_details: Optional["SubscriptionInvoicePreviewFragmentTaxDetails"] = Field(
        alias="taxDetails", default=None
    )
    discount: Optional["SubscriptionInvoicePreviewFragmentDiscount"] = Field(
        default=None
    )
    discount_details: Optional[
        "SubscriptionInvoicePreviewFragmentDiscountDetails"
    ] = Field(alias="discountDetails", default=None)
    credits: Optional["SubscriptionInvoicePreviewFragmentCredits"] = Field(default=None)
    last_updated_at: Any = Field(alias="lastUpdatedAt")
    lines: List["SubscriptionInvoicePreviewFragmentLines"]


class SubscriptionInvoicePreviewFragmentAmountDue(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentMinimumSpendAdjustment(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentSubTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentSubTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentTaxDetails(BaseModel):
    display_name: str = Field(alias="displayName")
    percentage: float
    inclusive: bool


class SubscriptionInvoicePreviewFragmentDiscount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentDiscountDetails(BaseModel):
    name: Optional[str] = Field(default=None)
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths", default=None)


class SubscriptionInvoicePreviewFragmentCredits(BaseModel):
    initial: "SubscriptionInvoicePreviewFragmentCreditsInitial"
    used: "SubscriptionInvoicePreviewFragmentCreditsUsed"
    remaining: "SubscriptionInvoicePreviewFragmentCreditsRemaining"


class SubscriptionInvoicePreviewFragmentCreditsInitial(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentCreditsUsed(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentCreditsRemaining(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentLines(BaseModel):
    type: InvoiceLineItemType
    description: str
    cost_description: str = Field(alias="costDescription")
    amount: "SubscriptionInvoicePreviewFragmentLinesAmount"
    unit_price: Optional["SubscriptionInvoicePreviewFragmentLinesUnitPrice"] = Field(
        alias="unitPrice", default=None
    )
    quantity: Optional[int] = Field(default=None)
    proration: bool
    price: Optional["SubscriptionInvoicePreviewFragmentLinesPrice"] = Field(
        default=None
    )
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    period: "SubscriptionInvoicePreviewFragmentLinesPeriod"
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)
    lines: Optional[List["SubscriptionInvoicePreviewFragmentLinesLines"]] = Field(
        default=None
    )


class SubscriptionInvoicePreviewFragmentLinesAmount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentLinesUnitPrice(BaseModel):
    amount: float
    currency: Currency


class SubscriptionInvoicePreviewFragmentLinesPrice(PriceFragment):
    pass


class SubscriptionInvoicePreviewFragmentLinesPeriod(BaseModel):
    start: Any
    end: Any


class SubscriptionInvoicePreviewFragmentLinesLines(BaseModel):
    type: InvoiceLineItemType
    description: str
    cost_description: str = Field(alias="costDescription")
    quantity: Optional[int] = Field(default=None)
    proration: bool
    usage_limit: Optional[float] = Field(alias="usageLimit", default=None)
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit", default=None)


class SubscriptionPreviewFragment(BaseModel):
    sub_total: "SubscriptionPreviewFragmentSubTotal" = Field(alias="subTotal")
    total_excluding_tax: "SubscriptionPreviewFragmentTotalExcludingTax" = Field(
        alias="totalExcludingTax"
    )
    total: "SubscriptionPreviewFragmentTotal"
    discount_amount: Optional["SubscriptionPreviewFragmentDiscountAmount"] = Field(
        alias="discountAmount", default=None
    )
    tax_details: Optional["SubscriptionPreviewFragmentTaxDetails"] = Field(
        alias="taxDetails", default=None
    )
    tax: Optional["SubscriptionPreviewFragmentTax"] = Field(default=None)
    billing_period_range: "SubscriptionPreviewFragmentBillingPeriodRange" = Field(
        alias="billingPeriodRange"
    )
    discount: Optional["SubscriptionPreviewFragmentDiscount"] = Field(default=None)
    subscription: Optional["SubscriptionPreviewFragmentSubscription"] = Field(
        default=None
    )
    proration: Optional["SubscriptionPreviewFragmentProration"] = Field(default=None)
    is_plan_downgrade: Optional[bool] = Field(alias="isPlanDowngrade", default=None)
    has_scheduled_updates: Optional[bool] = Field(
        alias="hasScheduledUpdates", default=None
    )
    credits: Optional["SubscriptionPreviewFragmentCredits"] = Field(default=None)


class SubscriptionPreviewFragmentSubTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentDiscountAmount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentTaxDetails(BaseModel):
    display_name: str = Field(alias="displayName")
    percentage: float
    inclusive: bool


class SubscriptionPreviewFragmentTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentBillingPeriodRange(BaseModel):
    start: Optional[Any] = Field(default=None)
    end: Optional[Any] = Field(default=None)


class SubscriptionPreviewFragmentDiscount(BaseModel):
    name: Optional[str] = Field(default=None)
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths", default=None)


class SubscriptionPreviewFragmentSubscription(BaseModel):
    sub_total: "SubscriptionPreviewFragmentSubscriptionSubTotal" = Field(
        alias="subTotal"
    )
    total_excluding_tax: "SubscriptionPreviewFragmentSubscriptionTotalExcludingTax" = (
        Field(alias="totalExcludingTax")
    )
    total: "SubscriptionPreviewFragmentSubscriptionTotal"
    tax: "SubscriptionPreviewFragmentSubscriptionTax"
    discount_amount: Optional[
        "SubscriptionPreviewFragmentSubscriptionDiscountAmount"
    ] = Field(alias="discountAmount", default=None)
    tax_details: Optional["SubscriptionPreviewFragmentSubscriptionTaxDetails"] = Field(
        alias="taxDetails", default=None
    )
    discount: Optional["SubscriptionPreviewFragmentSubscriptionDiscount"] = Field(
        default=None
    )


class SubscriptionPreviewFragmentSubscriptionSubTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentSubscriptionTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentSubscriptionTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentSubscriptionTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentSubscriptionDiscountAmount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentSubscriptionTaxDetails(BaseModel):
    display_name: str = Field(alias="displayName")
    percentage: float
    inclusive: bool


class SubscriptionPreviewFragmentSubscriptionDiscount(BaseModel):
    name: Optional[str] = Field(default=None)
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths", default=None)


class SubscriptionPreviewFragmentProration(BaseModel):
    proration_date: Any = Field(alias="prorationDate")
    credit: "SubscriptionPreviewFragmentProrationCredit"
    debit: "SubscriptionPreviewFragmentProrationDebit"
    net_amount: "SubscriptionPreviewFragmentProrationNetAmount" = Field(
        alias="netAmount"
    )


class SubscriptionPreviewFragmentProrationCredit(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentProrationDebit(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentProrationNetAmount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentCredits(BaseModel):
    initial: "SubscriptionPreviewFragmentCreditsInitial"
    used: "SubscriptionPreviewFragmentCreditsUsed"
    remaining: "SubscriptionPreviewFragmentCreditsRemaining"


class SubscriptionPreviewFragmentCreditsInitial(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentCreditsUsed(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewFragmentCreditsRemaining(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragment(BaseModel):
    total: "SubscriptionPreviewInvoiceFragmentTotal"
    sub_total: "SubscriptionPreviewInvoiceFragmentSubTotal" = Field(alias="subTotal")
    total_excluding_tax: "SubscriptionPreviewInvoiceFragmentTotalExcludingTax" = Field(
        alias="totalExcludingTax"
    )
    tax: Optional["SubscriptionPreviewInvoiceFragmentTax"] = Field(default=None)
    discount: Optional["SubscriptionPreviewInvoiceFragmentDiscount"] = Field(
        default=None
    )
    tax_details: Optional["SubscriptionPreviewInvoiceFragmentTaxDetails"] = Field(
        alias="taxDetails", default=None
    )
    discount_details: Optional[
        "SubscriptionPreviewInvoiceFragmentDiscountDetails"
    ] = Field(alias="discountDetails", default=None)


class SubscriptionPreviewInvoiceFragmentTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragmentSubTotal(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragmentTotalExcludingTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragmentTax(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragmentDiscount(BaseModel):
    amount: float
    currency: Currency


class SubscriptionPreviewInvoiceFragmentTaxDetails(BaseModel):
    display_name: str = Field(alias="displayName")
    percentage: float
    inclusive: bool


class SubscriptionPreviewInvoiceFragmentDiscountDetails(BaseModel):
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths", default=None)


class SubscriptionPreviewV2Fragment(BaseModel):
    immediate_invoice: "SubscriptionPreviewV2FragmentImmediateInvoice" = Field(
        alias="immediateInvoice"
    )
    recurring_invoice: Optional[
        "SubscriptionPreviewV2FragmentRecurringInvoice"
    ] = Field(alias="recurringInvoice", default=None)
    billing_period_range: "SubscriptionPreviewV2FragmentBillingPeriodRange" = Field(
        alias="billingPeriodRange"
    )
    is_plan_downgrade: Optional[bool] = Field(alias="isPlanDowngrade", default=None)
    has_scheduled_updates: Optional[bool] = Field(
        alias="hasScheduledUpdates", default=None
    )


class SubscriptionPreviewV2FragmentImmediateInvoice(
    ImmediateSubscriptionPreviewInvoiceFragment
):
    pass


class SubscriptionPreviewV2FragmentRecurringInvoice(SubscriptionPreviewInvoiceFragment):
    pass


class SubscriptionPreviewV2FragmentBillingPeriodRange(BaseModel):
    start: Optional[Any] = Field(default=None)
    end: Optional[Any] = Field(default=None)


class SubscriptionQueryFragment(BaseModel):
    subscription_id: str = Field(alias="subscriptionId")
    status: SubscriptionStatus
    pricing_type: PricingType = Field(alias="pricingType")
    start_date: Any = Field(alias="startDate")
    current_billing_period_end: Optional[Any] = Field(
        alias="currentBillingPeriodEnd", default=None
    )
    customer: "SubscriptionQueryFragmentCustomer"
    paying_customer: Optional["SubscriptionQueryFragmentPayingCustomer"] = Field(
        alias="payingCustomer", default=None
    )
    resource: Optional["SubscriptionQueryFragmentResource"] = Field(default=None)
    plan: "SubscriptionQueryFragmentPlan"
    addons: Optional[List["SubscriptionQueryFragmentAddons"]] = Field(default=None)
    trial_configuration: Optional[
        "SubscriptionQueryFragmentTrialConfiguration"
    ] = Field(alias="trialConfiguration", default=None)
    trial_end_date: Optional[Any] = Field(alias="trialEndDate", default=None)


class SubscriptionQueryFragmentCustomer(BaseModel):
    customer_id: str = Field(alias="customerId")


class SubscriptionQueryFragmentPayingCustomer(BaseModel):
    customer_id: str = Field(alias="customerId")


class SubscriptionQueryFragmentResource(BaseModel):
    resource_id: str = Field(alias="resourceId")


class SubscriptionQueryFragmentPlan(BaseModel):
    plan_id: str = Field(alias="planId")
    display_name: str = Field(alias="displayName")


class SubscriptionQueryFragmentAddons(BaseModel):
    quantity: float
    addon: "SubscriptionQueryFragmentAddonsAddon"


class SubscriptionQueryFragmentAddonsAddon(BaseModel):
    addon_id: str = Field(alias="addonId")


class SubscriptionQueryFragmentTrialConfiguration(BaseModel):
    trial_end_behavior: TrialEndBehavior = Field(alias="trialEndBehavior")


class UsageHistoryFragment(BaseModel):
    start_date: Any = Field(alias="startDate")
    end_date: Optional[Any] = Field(alias="endDate", default=None)
    markers: List["UsageHistoryFragmentMarkers"]
    usage_measurements: List["UsageHistoryFragmentUsageMeasurements"] = Field(
        alias="usageMeasurements"
    )
    groups: Optional[List["UsageHistoryFragmentGroups"]] = Field(default=None)


class UsageHistoryFragmentMarkers(BaseModel):
    type: UsageMarkerType
    timestamp: Any


class UsageHistoryFragmentUsageMeasurements(BaseModel):
    date: Any
    value: float
    is_reset_point: bool = Field(alias="isResetPoint")


class UsageHistoryFragmentGroups(BaseModel):
    group_info: List["UsageHistoryFragmentGroupsGroupInfo"] = Field(alias="groupInfo")
    usage_measurements: List["UsageHistoryFragmentGroupsUsageMeasurements"] = Field(
        alias="usageMeasurements"
    )


class UsageHistoryFragmentGroupsGroupInfo(BaseModel):
    key: str
    value: str


class UsageHistoryFragmentGroupsUsageMeasurements(BaseModel):
    date: Any
    value: float
    is_reset_point: bool = Field(alias="isResetPoint")


class UsageHistoryV2Fragment(BaseModel):
    markers: List["UsageHistoryV2FragmentMarkers"]
    series: List["UsageHistoryV2FragmentSeries"]


class UsageHistoryV2FragmentMarkers(BaseModel):
    type: UsageMarkerType
    timestamp: Any


class UsageHistoryV2FragmentSeries(BaseModel):
    tags: List["UsageHistoryV2FragmentSeriesTags"]
    points: List["UsageHistoryV2FragmentSeriesPoints"]


class UsageHistoryV2FragmentSeriesTags(BaseModel):
    key: str
    value: str


class UsageHistoryV2FragmentSeriesPoints(BaseModel):
    timestamp: Any
    value: float
    is_reset_point: bool = Field(alias="isResetPoint")


AddonDependencyFragment.model_rebuild()
PriceTierFragment.model_rebuild()
OveragePriceFragment.model_rebuild()
PriceFragment.model_rebuild()
PackageEntitlementFragment.model_rebuild()
AddonFragment.model_rebuild()
SlimCustomerFragment.model_rebuild()
SubscriptionFutureUpdateData.model_rebuild()
SubscriptionScheduledUpdateData.model_rebuild()
SubscriptionInvoiceFragment.model_rebuild()
TotalPriceFragment.model_rebuild()
SubscriptionTrialConfigurationFragment.model_rebuild()
ProductFragment.model_rebuild()
PlanCompatiblePackageGroupsFragment.model_rebuild()
PlanFragment.model_rebuild()
CustomerResourceFragment.model_rebuild()
SubscriptionFragment.model_rebuild()
FeatureFragment.model_rebuild()
EntitlementFragment.model_rebuild()
ApplySubscriptionFragment.model_rebuild()
FontVariantFragment.model_rebuild()
TypographyConfigurationFragment.model_rebuild()
CheckoutConfigurationFragment.model_rebuild()
CouponFragment.model_rebuild()
PromotionalEntitlementFragment.model_rebuild()
CustomerFragment.model_rebuild()
CheckoutStateFragment.model_rebuild()
CustomerPortalBillingInformationFragment.model_rebuild()
CustomerPortalConfigurationFragment.model_rebuild()
CustomerPortalEntitlementFragment.model_rebuild()
CustomerPortalSubscriptionPriceFragment.model_rebuild()
CustomerPortalSubscriptionAddonFragment.model_rebuild()
CustomerPortalSubscriptionScheduledUpdateDataFragment.model_rebuild()
CustomerPortalSubscriptionFragment.model_rebuild()
CustomerPortalPromotionalEntitlementFragment.model_rebuild()
CustomerPortalFragment.model_rebuild()
CustomerStatisticsFragment.model_rebuild()
CustomerWithSubscriptionsFragment.model_rebuild()
UsageUpdatedFragment.model_rebuild()
EntitlementUsageUpdated.model_rebuild()
EntitlementsUpdatedPayload.model_rebuild()
ImmediateSubscriptionPreviewInvoiceFragment.model_rebuild()
LayoutConfigurationFragment.model_rebuild()
MockPaywallAddonDependencyFragment.model_rebuild()
MockPaywallPackageEntitlementFragment.model_rebuild()
MockPaywallPriceFragment.model_rebuild()
MockPaywallAddonFragment.model_rebuild()
MockPaywallPlanCompatiblePackageGroupsFragment.model_rebuild()
MockPaywallPlanFragment.model_rebuild()
PackagePublishedPayload.model_rebuild()
PageInfoFragment.model_rebuild()
PaywallCalculatedPricePointsFragment.model_rebuild()
PaywallConfigurationFragment.model_rebuild()
PaywallCurrencyFragment.model_rebuild()
PaywallFragment.model_rebuild()
SlimSubscriptionFragment.model_rebuild()
ProvisionCustomerFragment.model_rebuild()
ProvisionSubscriptionFragment.model_rebuild()
ReportUsageFragment.model_rebuild()
SlimSubscriptionFragmentV2.model_rebuild()
SubscriptionInvoicePreviewFragment.model_rebuild()
SubscriptionPreviewFragment.model_rebuild()
SubscriptionPreviewInvoiceFragment.model_rebuild()
SubscriptionPreviewV2Fragment.model_rebuild()
SubscriptionQueryFragment.model_rebuild()
UsageHistoryFragment.model_rebuild()
UsageHistoryV2Fragment.model_rebuild()
