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

import datetime as dt
import typing

import pydantic

from ....core.datetime_utils import serialize_datetime
from ...commons.types.service_line_units import ServiceLineUnits
from .drug_identification import DrugIdentification
from .service_line_base import ServiceLineBase


class ServiceLineCreate(ServiceLineBase):
    procedure_code: str
    quantity: str
    units: ServiceLineUnits
    charge_amount_cents: typing.Optional[int] = pydantic.Field(
        description=(
            "The total amount charged for this service line taking quantity into account. For example, if a single unit\n"
            "costs 100 cents and 2 units were rendered, the charge_amount_cents should be 200. Should be greater than or\n"
            "equal to 0.\n"
        )
    )
    diagnosis_pointers: typing.List[int] = pydantic.Field(
        description=("Indices (zero-indexed) of all the diagnoses this service line references\n")
    )
    drug_identification: typing.Optional[DrugIdentification]

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        allow_population_by_field_name = True
        json_encoders = {dt.datetime: serialize_datetime}
