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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .billing_credit_ledger_response_data import BillingCreditLedgerResponseData
from .company_ledger_response_data import CompanyLedgerResponseData
from .feature_ledger_response_data import FeatureLedgerResponseData


class CreditLedgerEnrichedEntryResponseData(UniversalBaseModel):
    billing_credit_id: str
    company: typing.Optional[CompanyLedgerResponseData] = None
    company_id: str
    credit: typing.Optional[BillingCreditLedgerResponseData] = None
    expired_grant_count: int
    feature: typing.Optional[FeatureLedgerResponseData] = None
    feature_id: typing.Optional[str] = None
    first_transaction_at: dt.datetime
    free_grant_count: int
    grant_count: int
    last_transaction_at: dt.datetime
    manually_zeroed_count: int
    net_change: float
    plan_grant_count: int
    purchased_grant_count: int
    time_bucket: dt.datetime
    total_consumed: float
    total_granted: float
    transaction_count: int
    usage_count: int
    zeroed_out_count: int

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
