# 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_number: int


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


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