# 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,
    MeterType,
    MonthlyAccordingTo,
    PaymentCollection,
    PlanChangeType,
    PricingType,
    PromotionalEntitlementPeriod,
    PromotionalEntitlementStatus,
    ProvisionSubscriptionStatus,
    PublishMigrationType,
    SubscriptionDecisionStrategy,
    SubscriptionInvoiceBillingReason,
    SubscriptionInvoiceStatus,
    SubscriptionScheduleStatus,
    SubscriptionScheduleType,
    SubscriptionStatus,
    SyncStatus,
    TiersMode,
    TrialPeriodUnits,
    VendorIdentifier,
    WeeklyAccordingTo,
    WidgetType,
    experimentGroupType,
)


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


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


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


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


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")
    min_unit_quantity: Optional[float] = Field(alias="minUnitQuantity")
    max_unit_quantity: Optional[float] = Field(alias="maxUnitQuantity")
    billing_country_code: Optional[str] = Field(alias="billingCountryCode")
    price: Optional["PriceFragmentPrice"]
    tiers_mode: Optional[TiersMode] = Field(alias="tiersMode")
    tiers: Optional[List["PriceFragmentTiers"]]
    feature: Optional["PriceFragmentFeature"]
    block_size: Optional[float] = Field(alias="blockSize")


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


class PriceFragmentTiers(PriceTierFragment):
    pass


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


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


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


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


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")
    feature_units_plural: Optional[str] = Field(alias="featureUnitsPlural")
    display_name: str = Field(alias="displayName")
    description: Optional[str]


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


class AddonFragmentEntitlements(PackageEntitlementFragment):
    pass


class AddonFragmentPrices(PriceFragment):
    pass


class AddonFragmentOveragePrices(OveragePriceFragment):
    pass


class AddonFragmentDependencies(AddonDependencyFragment):
    pass


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


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


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


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


class EntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig(BaseModel):
    typename__: Literal["YearlyResetPeriodConfig"] = Field(alias="__typename")


class EntitlementFragmentFeature(FeatureFragment):
    pass


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


class PlanCompatiblePackageGroupsFragmentAddons(AddonFragment):
    pass


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


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


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


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


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


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


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


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 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")
    requires_action: bool = Field(alias="requiresAction")
    payment_secret: Optional[str] = Field(alias="paymentSecret")
    payment_url: Optional[str] = Field(alias="paymentUrl")
    pdf_url: Optional[str] = Field(alias="pdfUrl")
    billing_reason: Optional[SubscriptionInvoiceBillingReason] = Field(
        alias="billingReason"
    )
    currency: Optional[str]
    sub_total: Optional[float] = Field(alias="subTotal")
    sub_total_excluding_tax: Optional[float] = Field(alias="subTotalExcludingTax")
    total: Optional[float]
    total_excluding_tax: Optional[float] = Field(alias="totalExcludingTax")
    tax: Optional[float]
    amount_due: Optional[float] = Field(alias="amountDue")


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"
    )
    schedule_variables: Optional[
        Annotated[
            Union[
                "SubscriptionScheduledUpdateDataScheduleVariablesAddonChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesBillingPeriodChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesDowngradeChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariables",
                "SubscriptionScheduledUpdateDataScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables")


class SubscriptionScheduledUpdateDataTargetPackage(BaseModel):
    id: str
    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 SubscriptionScheduledUpdateDataScheduleVariablesBillingPeriodChangeVariables(
    BaseModel
):
    typename__: Literal["BillingPeriodChangeVariables"] = Field(alias="__typename")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod")


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


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


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


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")
    billable_features: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures")
    addons: Optional[
        List[
            "SubscriptionScheduledUpdateDataScheduleVariablesPlanChangeVariablesAddons"
        ]
    ]


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


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


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


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"
    )
    schedule_variables: Optional[
        Annotated[
            Union[
                "SubscriptionFutureUpdateDataScheduleVariablesAddonChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesBillingPeriodChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesDowngradeChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariables",
                "SubscriptionFutureUpdateDataScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables")


class SubscriptionFutureUpdateDataTargetPackage(BaseModel):
    id: str
    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 SubscriptionFutureUpdateDataScheduleVariablesBillingPeriodChangeVariables(
    BaseModel
):
    typename__: Literal["BillingPeriodChangeVariables"] = Field(alias="__typename")
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod")


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


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


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


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")
    billable_features: Optional[
        List[
            "SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures")
    addons: Optional[
        List["SubscriptionFutureUpdateDataScheduleVariablesPlanChangeVariablesAddons"]
    ]


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


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


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


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


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")
    price: Optional["SubscriptionFragmentPricesPrice"]


class SubscriptionFragmentPricesPrice(PriceFragment):
    pass


class SubscriptionFragmentTotalPrice(TotalPriceFragment):
    pass


class SubscriptionFragmentPlan(PlanFragment):
    pass


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


class SubscriptionFragmentAddonsAddon(AddonFragment):
    pass


class SubscriptionFragmentScheduledUpdates(SubscriptionScheduledUpdateData):
    pass


class SubscriptionFragmentFutureUpdates(SubscriptionFutureUpdateData):
    pass


class ApplySubscriptionFragment(BaseModel):
    subscription: Optional["ApplySubscriptionFragmentSubscription"]
    entitlements: Optional[List["ApplySubscriptionFragmentEntitlements"]]


class ApplySubscriptionFragmentSubscription(SubscriptionFragment):
    pass


class ApplySubscriptionFragmentEntitlements(EntitlementFragment):
    pass


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


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


class TypographyConfigurationFragmentH1(FontVariantFragment):
    pass


class TypographyConfigurationFragmentH2(FontVariantFragment):
    pass


class TypographyConfigurationFragmentH3(FontVariantFragment):
    pass


class TypographyConfigurationFragmentBody(FontVariantFragment):
    pass


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


class CheckoutConfigurationFragmentPalette(BaseModel):
    primary: Optional[str]
    text_color: Optional[str] = Field(alias="textColor")
    background_color: Optional[str] = Field(alias="backgroundColor")
    border_color: Optional[str] = Field(alias="borderColor")
    summary_background_color: Optional[str] = Field(alias="summaryBackgroundColor")
    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")


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


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


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


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


class CouponFragmentCustomers(BaseModel):
    id: str


class SlimCustomerFragment(BaseModel):
    id: str
    name: Optional[str]
    email: Optional[str]
    created_at: Optional[Any] = Field(alias="createdAt")
    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")
    additional_meta_data: Optional[Any] = Field(alias="additionalMetaData")
    aws_marketplace_customer_id: Optional[str] = Field(alias="awsMarketplaceCustomerId")


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_payment_expiration_year: Optional[int] = Field(
        alias="defaultPaymentExpirationYear"
    )
    default_payment_method_last_4_digits: Optional[str] = Field(
        alias="defaultPaymentMethodLast4Digits"
    )
    trialed_plans: Optional[List["CustomerFragmentTrialedPlans"]] = Field(
        alias="trialedPlans"
    )
    experiment_info: Optional["CustomerFragmentExperimentInfo"] = Field(
        alias="experimentInfo"
    )
    coupon: Optional["CustomerFragmentCoupon"]
    eligible_for_trial: Optional[List["CustomerFragmentEligibleForTrial"]] = Field(
        alias="eligibleForTrial"
    )
    promotional_entitlements: List["CustomerFragmentPromotionalEntitlements"] = Field(
        alias="promotionalEntitlements"
    )


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


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")
    product_ref_id: Optional[str] = Field(alias="productRefId")
    eligible: bool


class CustomerFragmentPromotionalEntitlements(PromotionalEntitlementFragment):
    pass


class CheckoutStateFragment(BaseModel):
    configuration: Optional["CheckoutStateFragmentConfiguration"]
    setup_secret: str = Field(alias="setupSecret")
    customer: "CheckoutStateFragmentCustomer"
    active_subscription: Optional["CheckoutStateFragmentActiveSubscription"] = Field(
        alias="activeSubscription"
    )
    resource: Optional["CheckoutStateFragmentResource"]
    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]
    name: Optional[str]
    default_payment_method_last_4_digits: Optional[str] = Field(
        alias="defaultPaymentMethodLast4Digits"
    )
    default_payment_method_id: Optional[str] = Field(alias="defaultPaymentMethodId")
    default_payment_expiration_month: Optional[int] = Field(
        alias="defaultPaymentExpirationMonth"
    )
    default_payment_expiration_year: Optional[int] = Field(
        alias="defaultPaymentExpirationYear"
    )


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


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


class CustomerPortalConfigurationFragmentTypography(TypographyConfigurationFragment):
    pass


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


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


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


class CustomerPortalEntitlementFragmentResetPeriodConfigurationYearlyResetPeriodConfig(
    BaseModel
):
    typename__: Literal["YearlyResetPeriodConfig"] = Field(alias="__typename")


class CustomerPortalEntitlementFragmentFeature(FeatureFragment):
    pass


class CustomerPortalSubscriptionPriceFragment(BaseModel):
    billing_period: Optional[BillingPeriod] = Field(alias="billingPeriod")
    billing_model: Optional[BillingModel] = Field(alias="billingModel")
    price: Optional["CustomerPortalSubscriptionPriceFragmentPrice"]
    feature: Optional["CustomerPortalSubscriptionPriceFragmentFeature"]


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


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


class CustomerPortalSubscriptionAddonFragment(BaseModel):
    addon_id: str = Field(alias="addonId")
    description: Optional[str]
    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")
    schedule_variables: Optional[
        Annotated[
            Union[
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesAddonChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesBillingPeriodChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesDowngradeChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariables",
                "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesUnitAmountChangeVariables",
            ],
            Field(discriminator="typename__"),
        ]
    ] = Field(alias="scheduleVariables")


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


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


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


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


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


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


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")
    billable_features: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesBillableFeatures"
        ]
    ] = Field(alias="billableFeatures")
    addons: Optional[
        List[
            "CustomerPortalSubscriptionScheduledUpdateDataFragmentScheduleVariablesPlanChangeVariablesAddons"
        ]
    ]


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


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


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


class CustomerPortalSubscriptionFragment(BaseModel):
    subscription_id: str = Field(alias="subscriptionId")
    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")
    billing_period_range: Optional[
        "CustomerPortalSubscriptionFragmentBillingPeriodRange"
    ] = Field(alias="billingPeriodRange")
    total_price: Optional["CustomerPortalSubscriptionFragmentTotalPrice"] = Field(
        alias="totalPrice"
    )
    addons: List["CustomerPortalSubscriptionFragmentAddons"]
    scheduled_updates: Optional[
        List["CustomerPortalSubscriptionFragmentScheduledUpdates"]
    ] = Field(alias="scheduledUpdates")


class CustomerPortalSubscriptionFragmentPrices(CustomerPortalSubscriptionPriceFragment):
    pass


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


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


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


class CustomerPortalSubscriptionFragmentBillingPeriodRange(BaseModel):
    start: Optional[Any]
    end: Optional[Any]


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")
    has_soft_limit: Optional[bool] = Field(alias="hasSoftLimit")
    usage_limit: Optional[float] = Field(alias="usageLimit")
    period: PromotionalEntitlementPeriod
    start_date: Any = Field(alias="startDate")
    end_date: Optional[Any] = Field(alias="endDate")


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")
    can_upgrade_subscription: bool = Field(alias="canUpgradeSubscription")
    configuration: Optional["CustomerPortalFragmentConfiguration"]
    resource: Optional["CustomerPortalFragmentResource"]


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"]


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"]]


class CustomerWithSubscriptionsFragmentSubscriptions(SubscriptionFragment):
    pass


class UsageUpdatedFragment(BaseModel):
    customer_id: str = Field(alias="customerId")
    resource_id: Optional[str] = Field(alias="resourceId")
    feature_id: str = Field(alias="featureId")
    current_usage: float = Field(alias="currentUsage")
    next_reset_date: Optional[float] = Field(alias="nextResetDate")


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")
    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"]
    discount: Optional["ImmediateSubscriptionPreviewInvoiceFragmentDiscount"]
    tax_details: Optional[
        "ImmediateSubscriptionPreviewInvoiceFragmentTaxDetails"
    ] = Field(alias="taxDetails")
    discount_details: Optional[
        "ImmediateSubscriptionPreviewInvoiceFragmentDiscountDetails"
    ] = Field(alias="discountDetails")
    credits: Optional["ImmediateSubscriptionPreviewInvoiceFragmentCredits"]
    proration: Optional["ImmediateSubscriptionPreviewInvoiceFragmentProration"]


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")


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")
    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]
    plan_width: Optional[float] = Field(alias="planWidth")
    plan_margin: Optional[float] = Field(alias="planMargin")
    plan_padding: Optional[float] = Field(alias="planPadding")


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


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


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


class MockPaywallPriceFragmentTiers(PriceTierFragment):
    pass


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


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


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


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


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]
    addons: Optional[List["MockPaywallPlanCompatiblePackageGroupsFragmentAddons"]]
    options: "MockPaywallPlanCompatiblePackageGroupsFragmentOptions"


class MockPaywallPlanCompatiblePackageGroupsFragmentAddons(MockPaywallAddonFragment):
    pass


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


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


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


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


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 PaywallCalculatedPricePointsFragment(BaseModel):
    plan_id: str = Field(alias="planId")
    additional_charges_may_apply: Optional[bool] = Field(
        alias="additionalChargesMayApply"
    )
    billing_period: BillingPeriod = Field(alias="billingPeriod")
    amount: float
    currency: Currency
    billing_country_code: Optional[str] = Field(alias="billingCountryCode")
    feature: Optional["PaywallCalculatedPricePointsFragmentFeature"]


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


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


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


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"]
    customer: Optional["PaywallFragmentCustomer"]
    active_subscriptions: Optional[List["PaywallFragmentActiveSubscriptions"]] = Field(
        alias="activeSubscriptions"
    )
    resource: Optional["PaywallFragmentResource"]
    paywall_calculated_price_points: Optional[
        List["PaywallFragmentPaywallCalculatedPricePoints"]
    ] = Field(alias="paywallCalculatedPricePoints")


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: str
    subscription_id: str = Field(alias="subscriptionId")
    ref_id: str = Field(alias="refId")
    status: SubscriptionStatus
    additional_meta_data: Optional[Any] = Field(alias="additionalMetaData")
    billing_id: Optional[str] = Field(alias="billingId")
    billing_link_url: Optional[str] = Field(alias="billingLinkUrl")
    effective_end_date: Optional[Any] = Field(alias="effectiveEndDate")
    current_billing_period_end: Optional[Any] = Field(alias="currentBillingPeriodEnd")
    pricing_type: PricingType = Field(alias="pricingType")
    latest_invoice: Optional["SlimSubscriptionFragmentLatestInvoice"] = Field(
        alias="latestInvoice"
    )
    payment_collection: PaymentCollection = Field(alias="paymentCollection")
    billing_sync_error: Optional[str] = Field(alias="billingSyncError")
    resource: Optional["SlimSubscriptionFragmentResource"]
    experiment_info: Optional["SlimSubscriptionFragmentExperimentInfo"] = Field(
        alias="experimentInfo"
    )
    prices: Optional[List["SlimSubscriptionFragmentPrices"]]
    total_price: Optional["SlimSubscriptionFragmentTotalPrice"] = Field(
        alias="totalPrice"
    )
    plan: "SlimSubscriptionFragmentPlan"
    addons: Optional[List["SlimSubscriptionFragmentAddons"]]
    customer: "SlimSubscriptionFragmentCustomer"


class SlimSubscriptionFragmentLatestInvoice(SubscriptionInvoiceFragment):
    pass


class SlimSubscriptionFragmentResource(CustomerResourceFragment):
    pass


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


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


class SlimSubscriptionFragmentPricesPrice(PriceFragment):
    pass


class SlimSubscriptionFragmentTotalPrice(TotalPriceFragment):
    pass


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


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


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


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


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


class ProvisionCustomerFragmentCustomer(SlimCustomerFragment):
    pass


class ProvisionCustomerFragmentSubscription(SlimSubscriptionFragment):
    pass


class ProvisionCustomerFragmentEntitlements(EntitlementFragment):
    pass


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


class ProvisionSubscriptionFragmentSubscription(SlimSubscriptionFragment):
    pass


class ProvisionSubscriptionFragmentEntitlements(EntitlementFragment):
    pass


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


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"
    )
    tax_details: Optional["SubscriptionPreviewFragmentTaxDetails"] = Field(
        alias="taxDetails"
    )
    tax: Optional["SubscriptionPreviewFragmentTax"]
    billing_period_range: "SubscriptionPreviewFragmentBillingPeriodRange" = Field(
        alias="billingPeriodRange"
    )
    discount: Optional["SubscriptionPreviewFragmentDiscount"]
    subscription: Optional["SubscriptionPreviewFragmentSubscription"]
    proration: Optional["SubscriptionPreviewFragmentProration"]
    is_plan_downgrade: Optional[bool] = Field(alias="isPlanDowngrade")
    has_scheduled_updates: Optional[bool] = Field(alias="hasScheduledUpdates")
    credits: Optional["SubscriptionPreviewFragmentCredits"]


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]
    end: Optional[Any]


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


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")
    tax_details: Optional["SubscriptionPreviewFragmentSubscriptionTaxDetails"] = Field(
        alias="taxDetails"
    )
    discount: Optional["SubscriptionPreviewFragmentSubscriptionDiscount"]


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):
    type: DiscountType
    value: float
    duration_type: DiscountDurationType = Field(alias="durationType")
    duration_in_months: Optional[float] = Field(alias="durationInMonths")


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"]
    discount: Optional["SubscriptionPreviewInvoiceFragmentDiscount"]
    tax_details: Optional["SubscriptionPreviewInvoiceFragmentTaxDetails"] = Field(
        alias="taxDetails"
    )
    discount_details: Optional[
        "SubscriptionPreviewInvoiceFragmentDiscountDetails"
    ] = Field(alias="discountDetails")


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")


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


class SubscriptionPreviewV2FragmentImmediateInvoice(
    ImmediateSubscriptionPreviewInvoiceFragment
):
    pass


class SubscriptionPreviewV2FragmentRecurringInvoice(SubscriptionPreviewInvoiceFragment):
    pass


class SubscriptionPreviewV2FragmentBillingPeriodRange(BaseModel):
    start: Optional[Any]
    end: Optional[Any]


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


class UsageHistoryFragmentUsageMeasurements(BaseModel):
    date: Any
    value: float
    is_reset_point: Optional[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: Optional[bool] = Field(alias="isResetPoint")


AddonDependencyFragment.model_rebuild()
PriceTierFragment.model_rebuild()
PriceFragment.model_rebuild()
PackageEntitlementFragment.model_rebuild()
OveragePriceFragment.model_rebuild()
AddonFragment.model_rebuild()
FeatureFragment.model_rebuild()
EntitlementFragment.model_rebuild()
PlanCompatiblePackageGroupsFragment.model_rebuild()
ProductFragment.model_rebuild()
PlanFragment.model_rebuild()
CustomerResourceFragment.model_rebuild()
TotalPriceFragment.model_rebuild()
SubscriptionInvoiceFragment.model_rebuild()
SubscriptionScheduledUpdateData.model_rebuild()
SubscriptionFutureUpdateData.model_rebuild()
SubscriptionFragment.model_rebuild()
ApplySubscriptionFragment.model_rebuild()
FontVariantFragment.model_rebuild()
TypographyConfigurationFragment.model_rebuild()
CheckoutConfigurationFragment.model_rebuild()
PromotionalEntitlementFragment.model_rebuild()
CouponFragment.model_rebuild()
SlimCustomerFragment.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()
MockPaywallPriceFragment.model_rebuild()
MockPaywallPackageEntitlementFragment.model_rebuild()
MockPaywallAddonFragment.model_rebuild()
MockPaywallPlanCompatiblePackageGroupsFragment.model_rebuild()
MockPaywallPlanFragment.model_rebuild()
PackagePublishedPayload.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()
SubscriptionPreviewFragment.model_rebuild()
SubscriptionPreviewInvoiceFragment.model_rebuild()
SubscriptionPreviewV2Fragment.model_rebuild()
UsageHistoryFragment.model_rebuild()
