# WARNING: This file is autogenerated by FHIR Schema Codegen.
# https://github.com/fhir-schema/fhir-schema-codegen
# Any manual changes made to this file may be overwritten.

from __future__ import annotations
from pydantic import ConfigDict, Field
from typing import List as PyList, Literal

from fhirschemapy.R4B.base import CodeableConcept, Identifier, Money, Reference
from fhirschemapy.R4B.domain_resource import DomainResource


class PaymentNotice(DomainResource):
    model_config = ConfigDict(serialize_by_alias=True, extra="forbid")

    resource_type: str = Field(
        default="PaymentNotice",
        alias="resourceType",
        serialization_alias="resourceType",
        frozen=True,
        pattern="PaymentNotice",
    )

    amount: Money = Field(alias="amount", serialization_alias="amount")
    created: str = Field(alias="created", serialization_alias="created")
    identifier: PyList[Identifier] | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    payee: Reference | None = Field(None, alias="payee", serialization_alias="payee")
    payment: Reference = Field(alias="payment", serialization_alias="payment")
    payment_date: str | None = Field(
        None, alias="paymentDate", serialization_alias="paymentDate"
    )
    payment_status: CodeableConcept | None = Field(
        None, alias="paymentStatus", serialization_alias="paymentStatus"
    )
    provider: Reference | None = Field(
        None, alias="provider", serialization_alias="provider"
    )
    recipient: Reference = Field(alias="recipient", serialization_alias="recipient")
    request: Reference | None = Field(
        None, alias="request", serialization_alias="request"
    )
    response: Reference | None = Field(
        None, alias="response", serialization_alias="response"
    )
    status: Literal["active", "cancelled", "draft", "entered-in-error"] = Field(
        alias="status", serialization_alias="status"
    )

    def to_json(self, indent: int | None = None) -> str:
        return self.model_dump_json(
            exclude_unset=True, exclude_none=True, indent=indent
        )

    @classmethod
    def from_json(cls, json: str) -> PaymentNotice:
        return cls.model_validate_json(json)
