# 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

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


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

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

    active: bool | None = Field(None, alias="active", serialization_alias="active")
    actor: PyList[Reference] = Field(alias="actor", serialization_alias="actor")
    comment: str | None = Field(None, alias="comment", serialization_alias="comment")
    identifier: PyList[Identifier] | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    planning_horizon: Period | None = Field(
        None, alias="planningHorizon", serialization_alias="planningHorizon"
    )
    service_category: PyList[CodeableConcept] | None = Field(
        None, alias="serviceCategory", serialization_alias="serviceCategory"
    )
    service_type: PyList[CodeableConcept] | None = Field(
        None, alias="serviceType", serialization_alias="serviceType"
    )
    specialty: PyList[CodeableConcept] | None = Field(
        None, alias="specialty", serialization_alias="specialty"
    )

    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) -> Schedule:
        return cls.model_validate_json(json)
