"""
Generated class for TestReport. 
Time: 2024-06-14 18:37:55
"""

from fhirmodels.R5.BackboneElement import *
from fhirmodels.R5.DomainResource import *
from fhirmodels.R5.Extension import *
from fhirmodels.R5.Identifier import *
from fhirmodels.R5.Meta import *
from fhirmodels.R5.Narrative import *
from fhirmodels.R5.Resource import *


class Participant(FhirBaseModel):
    """A participant in the test execution, either the execution engine, a client, or a server.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param str type: test-engine | client | server
    :param str uri: The uri of the participant. An absolute URL is preferred
    :param str display: The display name of the participant
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        type: "str" = None,
        uri: "str" = None,
        display: "str" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.type = type
        self.uri = uri
        self.display = display

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Operation(FhirBaseModel):
    """The operation performed.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param str result: pass | skip | fail | warning | error
    :param str message: A message associated with the result
    :param str detail: A link to further details on the result
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        result: "str" = None,
        message: "str" = None,
        detail: "str" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.result = result
        self.message = message
        self.detail = detail

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Requirement(FhirBaseModel):
    """Links or references providing traceability to the testing requirements for this assert.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param str linkUri: Link or reference to the testing requirement
    :param str linkCanonical: Link or reference to the testing requirement
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        linkUri: "str" = None,
        linkCanonical: "str" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.linkUri = linkUri
        self.linkCanonical = linkCanonical

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class _assert(FhirBaseModel):
    """The results of the assertion performed on the previous operations.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param str result: pass | skip | fail | warning | error
    :param str message: A message associated with the result
    :param str detail: A link to further details on the result
    :param Requirement requirement: Links or references to the testing requirements
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "requirement": {"class_name": "Requirement", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        result: "str" = None,
        message: "str" = None,
        detail: "str" = None,
        requirement: list["Requirement"] = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.result = result
        self.message = message
        self.detail = detail
        self.requirement = requirement or []

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Action(FhirBaseModel):
    """Action would contain either an operation or an assertion.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param Operation operation: The operation to perform
    :param _assert _assert: The assertion to perform
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "operation": {"class_name": "Operation", "is_contained": True},
        "_assert": {"class_name": "_assert", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        operation: "Operation" = None,
        _assert: "_assert" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.operation = operation
        self._assert = _assert

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Setup(FhirBaseModel):
    """The results of the series of required setup operations before the tests were executed.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param Action action: A setup operation or assert that was executed
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "action": {"class_name": "Action", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        action: list["Action"] = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.action = action or []

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Action(FhirBaseModel):
    """Action would contain either an operation or an assertion.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param Operation operation: The operation performed
    :param _assert _assert: The assertion performed
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "operation": {"class_name": "Operation", "is_contained": True},
        "_assert": {"class_name": "_assert", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        operation: "Operation" = None,
        _assert: "_assert" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.operation = operation
        self._assert = _assert

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Test(FhirBaseModel):
    """A test executed from the test script.:param str testScript: Canonical URL to the  version-specific TestScript that was executed to produce this TestReport
    :param str tester: Name of the tester producing this report (Organization or individual)
    :param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param str name: Tracking/logging name of this test
    :param str description: Tracking/reporting short description of the test
    :param Action action: A test operation or assert that was performed
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "action": {"class_name": "Action", "is_contained": True},
    }

    def __init__(
        self,
        testScript: "str" = None,
        tester: "str" = None,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        name: "str" = None,
        description: "str" = None,
        action: list["Action"] = None,
    ):
        self.testScript = testScript
        self.tester = tester
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.name = name
        self.description = description
        self.action = action or []

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Action(FhirBaseModel):
    """The teardown action will only contain an operation.:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param Operation operation: The teardown operation performed
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "operation": {"class_name": "Operation", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        operation: "Operation" = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.operation = operation

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class Teardown(FhirBaseModel):
    """The results of the series of operations required to clean up after all the tests were executed (successfully or otherwise).:param str id: Unique id for inter-element referencing
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored even if unrecognized
    :param Action action: One or more teardown operations performed
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "action": {"class_name": "Action", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        action: list["Action"] = None,
    ):
        self.id = id
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.action = action or []

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()


class TestReport(DomainResource):
    """A summary of information based on the results of executing a TestScript.
    :param str id: Logical id of this artifact
    :param Meta meta: Metadata about the resource
    :param str implicitRules: A set of rules under which this content was created
    :param str language: Language of the resource content
    :param Narrative text: Text summary of the resource, for human interpretation
    :param Resource contained: Contained, inline Resources
    :param Extension extension: Additional content defined by implementations
    :param Extension modifierExtension: Extensions that cannot be ignored
    :param Identifier identifier: External identifier
    :param str name: Informal name of the executed TestReport
    :param str status: completed | in-progress | waiting | stopped | entered-in-error
    :param str testScript: Canonical URL to the  version-specific TestScript that was executed to produce this TestReport
    :param str result: pass | fail | pending
    :param float score: The final score (percentage of tests passed) resulting from the execution of the TestScript
    :param str tester: Name of the tester producing this report (Organization or individual)
    :param str issued: When the TestScript was executed and this TestReport was generated
    :param Participant participant: A participant in the test execution, either the execution engine, a client, or a server
    :param Setup setup: The results of the series of required setup operations before the tests were executed
    :param Test test: A test executed from the test script
    :param Teardown teardown: The results of running the series of required clean up steps
    """

    # needed for complex properties where the element name is different from the class name
    property_class_info = {
        "meta": {"class_name": "Meta", "is_contained": False},
        "text": {"class_name": "Narrative", "is_contained": False},
        "contained": {"class_name": "Resource", "is_contained": False},
        "extension": {"class_name": "Extension", "is_contained": False},
        "modifierExtension": {"class_name": "Extension", "is_contained": False},
        "identifier": {"class_name": "Identifier", "is_contained": False},
        "participant": {"class_name": "Participant", "is_contained": True},
        "setup": {"class_name": "Setup", "is_contained": True},
        "test": {"class_name": "Test", "is_contained": True},
        "teardown": {"class_name": "Teardown", "is_contained": True},
    }

    def __init__(
        self,
        id: "str" = None,
        meta: "Meta" = None,
        implicitRules: "str" = None,
        language: "str" = None,
        text: "Narrative" = None,
        contained: list["Resource"] = None,
        extension: list["Extension"] = None,
        modifierExtension: list["Extension"] = None,
        identifier: "Identifier" = None,
        name: "str" = None,
        status: "str" = None,
        testScript: "str" = None,
        result: "str" = None,
        score: "float" = None,
        tester: "str" = None,
        issued: "str" = None,
        participant: list["Participant"] = None,
        setup: "Setup" = None,
        test: list["Test"] = None,
        teardown: "Teardown" = None,
    ):

        self.resourceType = "TestReport"

        self.id = id
        self.meta = meta
        self.implicitRules = implicitRules
        self.language = language
        self.text = text
        self.contained = contained or []
        self.extension = extension or []
        self.modifierExtension = modifierExtension or []
        self.identifier = identifier
        self.name = name
        self.status = status
        self.testScript = testScript
        self.result = result
        self.score = score
        self.tester = tester
        self.issued = issued
        self.participant = participant or []
        self.setup = setup
        self.test = test or []
        self.teardown = teardown

    @classmethod
    def from_dict(cls, data: dict) -> "TestReport":
        return super().from_dict(data)

    @classmethod
    def from_obj(self, obj: object) -> "TestReport":
        return super().from_obj(obj)

    def as_dict(self) -> dict:
        return super().as_dict()
