from __future__ import annotations
from typing import Optional, TYPE_CHECKING, Union

# noinspection PyPackageRequirements
from pyspark.sql.types import StructType, DataType
from spark_auto_mapper_fhir.fhir_types.list import FhirList
from spark_auto_mapper_fhir.complex_types.meta import Meta
from spark_auto_mapper_fhir.fhir_types.id import FhirId
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri

from spark_auto_mapper_fhir.base_types.fhir_resource_base import FhirResourceBase
from spark_fhir_schemas.r4.resources.bundle import BundleSchema

if TYPE_CHECKING:
    pass
    # id_ (id)
    # meta (Meta)
    # implicitRules (uri)
    # language (CommonLanguages)
    from spark_auto_mapper_fhir.value_sets.common_languages import CommonLanguagesCode

    # identifier (Identifier)
    from spark_auto_mapper_fhir.complex_types.identifier import Identifier

    # type_ (BundleType)
    from spark_auto_mapper_fhir.value_sets.bundle_type import BundleTypeCode

    # timestamp (instant)
    from spark_auto_mapper_fhir.fhir_types.instant import FhirInstant

    # total (unsignedInt)
    from spark_auto_mapper_fhir.fhir_types.unsigned_int import FhirUnsignedInt

    # link (Bundle.Link)
    from spark_auto_mapper_fhir.backbone_elements.bundle_link import BundleLink

    # entry (Bundle.Entry)
    from spark_auto_mapper_fhir.backbone_elements.bundle_entry import BundleEntry

    # signature (Signature)
    from spark_auto_mapper_fhir.complex_types.signature import Signature


# This file is auto-generated by generate_classes so do not edit manually
# noinspection PyPep8Naming
class Bundle(FhirResourceBase):
    """
    Bundle
    bundle.xsd
        A container for a collection of resources.
        If the element is present, it must have either a @value, an @id, or extensions
    """

    # noinspection PyPep8Naming
    def __init__(
        self,
        *,
        id_: Optional[FhirId] = None,
        meta: Optional[Meta] = None,
        implicitRules: Optional[FhirUri] = None,
        language: Optional[CommonLanguagesCode] = None,
        identifier: Optional[Identifier] = None,
        type_: BundleTypeCode,
        timestamp: Optional[FhirInstant] = None,
        total: Optional[FhirUnsignedInt] = None,
        link: Optional[FhirList[BundleLink]] = None,
        entry: Optional[FhirList[BundleEntry]] = None,
        signature: Optional[Signature] = None,
    ) -> None:
        """
            A container for a collection of resources.
            If the element is present, it must have either a @value, an @id, or extensions

            :param id_: The logical id of the resource, as used in the URL for the resource. Once
        assigned, this value never changes.
            :param meta: The metadata about the resource. This is content that is maintained by the
        infrastructure. Changes to the content might not always be associated with
        version changes to the resource.
            :param implicitRules: A reference to a set of rules that were followed when the resource was
        constructed, and which must be understood when processing the content. Often,
        this is a reference to an implementation guide that defines the special rules
        along with other profiles etc.
            :param language: The base language in which the resource is written.
            :param identifier: A persistent identifier for the bundle that won't change as a bundle is copied
        from server to server.
            :param type_: Indicates the purpose of this bundle - how it is intended to be used.
            :param timestamp: The date/time that the bundle was assembled - i.e. when the resources were
        placed in the bundle.
            :param total: If a set of search matches, this is the total number of entries of type
        'match' across all pages in the search.  It does not include search.mode =
        'include' or 'outcome' entries and it does not provide a count of the number
        of entries in the Bundle.
            :param link: A series of links that provide context to this bundle.
            :param entry: An entry in a bundle resource - will either contain a resource or information
        about a resource (transactions and history only).
            :param signature: Digital Signature - base64 encoded. XML-DSig or a JWT.
        """
        super().__init__(
            resourceType="Bundle",
            id_=id_,
            meta=meta,
            implicitRules=implicitRules,
            language=language,
            identifier=identifier,
            type_=type_,
            timestamp=timestamp,
            total=total,
            link=link,
            entry=entry,
            signature=signature,
        )

    def get_schema(
        self, include_extension: bool
    ) -> Optional[Union[StructType, DataType]]:
        return BundleSchema.get_schema(include_extension=include_extension)

from __future__ import annotations
from typing import Optional, TYPE_CHECKING, Union

# noinspection PyPackageRequirements
from pyspark.sql.types import StructType, DataType
from spark_auto_mapper_fhir.fhir_types.list import FhirList
from spark_auto_mapper_fhir.complex_types.meta import Meta
from spark_auto_mapper_fhir.fhir_types.id import FhirId
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri

from spark_auto_mapper_fhir.base_types.fhir_resource_base import FhirResourceBase
from spark_fhir_schemas.r4.resources.bundle import BundleSchema

if TYPE_CHECKING:
    pass
    # id_ (id)
    # meta (Meta)
    # implicitRules (uri)
    # language (CommonLanguages)
    from spark_auto_mapper_fhir.value_sets.common_languages import CommonLanguagesCode

    # identifier (Identifier)
    from spark_auto_mapper_fhir.complex_types.identifier import Identifier

    # type_ (BundleType)
    from spark_auto_mapper_fhir.value_sets.bundle_type import BundleTypeCode

    # timestamp (instant)
    from spark_auto_mapper_fhir.fhir_types.instant import FhirInstant

    # total (unsignedInt)
    from spark_auto_mapper_fhir.fhir_types.unsigned_int import FhirUnsignedInt

    # link (Bundle.Link)
    from spark_auto_mapper_fhir.backbone_elements.bundle_link import BundleLink

    # entry (Bundle.Entry)
    from spark_auto_mapper_fhir.backbone_elements.bundle_entry import BundleEntry

    # signature (Signature)
    from spark_auto_mapper_fhir.complex_types.signature import Signature


# This file is auto-generated by generate_classes so do not edit manually
# noinspection PyPep8Naming
class Bundle(FhirResourceBase):
    """
    Bundle
    bundle.xsd
        A container for a collection of resources.
        If the element is present, it must have either a @value, an @id, or extensions
    """

    # noinspection PyPep8Naming
    def __init__(
        self,
        *,
        id_: Optional[FhirId] = None,
        meta: Optional[Meta] = None,
        implicitRules: Optional[FhirUri] = None,
        language: Optional[CommonLanguagesCode] = None,
        identifier: Optional[Identifier] = None,
        type_: BundleTypeCode,
        timestamp: Optional[FhirInstant] = None,
        total: Optional[FhirUnsignedInt] = None,
        link: Optional[FhirList[BundleLink]] = None,
        entry: Optional[FhirList[BundleEntry]] = None,
        signature: Optional[Signature] = None,
    ) -> None:
        """
            A container for a collection of resources.
            If the element is present, it must have either a @value, an @id, or extensions

            :param id_: The logical id of the resource, as used in the URL for the resource. Once
        assigned, this value never changes.
            :param meta: The metadata about the resource. This is content that is maintained by the
        infrastructure. Changes to the content might not always be associated with
        version changes to the resource.
            :param implicitRules: A reference to a set of rules that were followed when the resource was
        constructed, and which must be understood when processing the content. Often,
        this is a reference to an implementation guide that defines the special rules
        along with other profiles etc.
            :param language: The base language in which the resource is written.
            :param identifier: A persistent identifier for the bundle that won't change as a bundle is copied
        from server to server.
            :param type_: Indicates the purpose of this bundle - how it is intended to be used.
            :param timestamp: The date/time that the bundle was assembled - i.e. when the resources were
        placed in the bundle.
            :param total: If a set of search matches, this is the total number of entries of type
        'match' across all pages in the search.  It does not include search.mode =
        'include' or 'outcome' entries and it does not provide a count of the number
        of entries in the Bundle.
            :param link: A series of links that provide context to this bundle.
            :param entry: An entry in a bundle resource - will either contain a resource or information
        about a resource (transactions and history only).
            :param signature: Digital Signature - base64 encoded. XML-DSig or a JWT.
        """
        super().__init__(
            resourceType="Bundle",
            id_=id_,
            meta=meta,
            implicitRules=implicitRules,
            language=language,
            identifier=identifier,
            type_=type_,
            timestamp=timestamp,
            total=total,
            link=link,
            entry=entry,
            signature=signature,
        )

    def get_schema(
        self, include_extension: bool
    ) -> Optional[Union[StructType, DataType]]:
        return BundleSchema.get_schema(include_extension=include_extension)

# noinspection PyPackageRequirements # id_ (id) # meta (Meta) # implicitRules (uri) # language (CommonLanguages) # identifier (Identifier) # type_ (BundleType) # timestamp (instant) # total (unsignedInt) # link (Bundle.Link) # entry (Bundle.Entry) # signature (Signature) # This file is auto-generated by generate_classes so do not edit manually # noinspection PyPep8Naming Bundle     bundle.xsd         A container for a collection of resources.         If the element is present, it must have either a @value, an @id, or extensions # noinspection PyPep8Naming A container for a collection of resources.             If the element is present, it must have either a @value, an @id, or extensions              :param id_: The logical id of the resource, as used in the URL for the resource. Once         assigned, this value never changes.             :param meta: The metadata about the resource. This is content that is maintained by the         infrastructure. Changes to the content might not always be associated with         version changes to the resource.             :param implicitRules: A reference to a set of rules that were followed when the resource was         constructed, and which must be understood when processing the content. Often,         this is a reference to an implementation guide that defines the special rules         along with other profiles etc.             :param language: The base language in which the resource is written.             :param identifier: A persistent identifier for the bundle that won't change as a bundle is copied         from server to server.             :param type_: Indicates the purpose of this bundle - how it is intended to be used.             :param timestamp: The date/time that the bundle was assembled - i.e. when the resources were         placed in the bundle.             :param total: If a set of search matches, this is the total number of entries of type         'match' across all pages in the search.  It does not include search.mode =         'include' or 'outcome' entries and it does not provide a count of the number         of entries in the Bundle.             :param link: A series of links that provide context to this bundle.             :param entry: An entry in a bundle resource - will either contain a resource or information         about a resource (transactions and history only).             :param signature: Digital Signature - base64 encoded. XML-DSig or a JWT.