# 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 Identifier, Reference
from fhirschemapy.R4B.domain_resource import DomainResource


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

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

    created: str | None = Field(None, alias="created", serialization_alias="created")
    disposition: str | None = Field(
        None, alias="disposition", serialization_alias="disposition"
    )
    identifier: PyList[Identifier] | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    organization: Reference | None = Field(
        None, alias="organization", serialization_alias="organization"
    )
    outcome: Literal["queued", "complete", "error", "partial"] | None = Field(
        None, alias="outcome", serialization_alias="outcome"
    )
    request: Reference | None = Field(
        None, alias="request", serialization_alias="request"
    )
    request_provider: Reference | None = Field(
        None, alias="requestProvider", serialization_alias="requestProvider"
    )
    status: Literal["active", "cancelled", "draft", "entered-in-error"] | None = Field(
        None, 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) -> EnrollmentResponse:
        return cls.model_validate_json(json)
