# 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 (
    Annotation,
    CodeableConcept,
    DataRequirement,
    Identifier,
    Reference,
)
from fhirschemapy.R4B.domain_resource import DomainResource


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

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

    data_requirement: PyList[DataRequirement] | None = Field(
        None, alias="dataRequirement", serialization_alias="dataRequirement"
    )
    encounter: Reference | None = Field(
        None, alias="encounter", serialization_alias="encounter"
    )
    evaluation_message: PyList[Reference] | None = Field(
        None, alias="evaluationMessage", serialization_alias="evaluationMessage"
    )
    identifier: PyList[Identifier] | None = Field(
        None, alias="identifier", serialization_alias="identifier"
    )
    module_canonical: str | None = Field(
        None, alias="moduleCanonical", serialization_alias="moduleCanonical"
    )
    module_codeable_concept: CodeableConcept | None = Field(
        None, alias="moduleCodeableConcept", serialization_alias="moduleCodeableConcept"
    )
    module_uri: str | None = Field(
        None, alias="moduleUri", serialization_alias="moduleUri"
    )
    note: PyList[Annotation] | None = Field(
        None, alias="note", serialization_alias="note"
    )
    occurrence_date_time: str | None = Field(
        None, alias="occurrenceDateTime", serialization_alias="occurrenceDateTime"
    )
    output_parameters: Reference | None = Field(
        None, alias="outputParameters", serialization_alias="outputParameters"
    )
    performer: Reference | None = Field(
        None, alias="performer", serialization_alias="performer"
    )
    reason_code: PyList[CodeableConcept] | None = Field(
        None, alias="reasonCode", serialization_alias="reasonCode"
    )
    reason_reference: PyList[Reference] | None = Field(
        None, alias="reasonReference", serialization_alias="reasonReference"
    )
    request_identifier: Identifier | None = Field(
        None, alias="requestIdentifier", serialization_alias="requestIdentifier"
    )
    result: Reference | None = Field(None, alias="result", serialization_alias="result")
    status: Literal[
        "success",
        "data-requested",
        "data-required",
        "in-progress",
        "failure",
        "entered-in-error",
    ] = Field(alias="status", serialization_alias="status")
    subject: Reference | None = Field(
        None, alias="subject", serialization_alias="subject"
    )

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