# generated by datamodel-codegen:
#   filename:  discriminator_force_optional.yaml
#   timestamp: 2019-07-26T00:00:00+00:00

from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field, RootModel


class CardPayment(BaseModel):
    kind: Literal['card'] = 'card'
    card_number: int | None = None


class CashPayment(BaseModel):
    kind: Literal['cash'] = 'cash'
    received_amount: int | None = None


class Payment(RootModel[CardPayment | CashPayment | None]):
    root: CardPayment | CashPayment | None = Field(None, discriminator='kind')
