import importlib.metadata
import pathlib

from platformdirs import user_data_dir

CONFIG_DIRECTORY = pathlib.Path(
    user_data_dir("fhirguard", ensure_exists=True)
).resolve()
SIMPLIFIER_REGISTRY = "https://packages.simplifier.net"
FHIRGUARD_VERSION = importlib.metadata.version("fhirguard")
DEFAULT_FILE_COMMENT = f"This file was automatically generated by FHIRGuard v{FHIRGUARD_VERSION}. DO NOT EDIT DIRECTLY."

UCUM_API_URL = "https://clinicaltables.nlm.nih.gov/api/ucum/v3/search"

SUPPORTED_BCP_STANDARDS = []

SUPPORTED_IETF_STANDARDS = [
    "urn:ietf:rfc:3986",  # URI
    "urn:ietf:bcp:47",  # Language codes
    "urn:ietf:bcp:13",  # Timezone codes
]

SUPPORTED_ISO_STANDARDS = [
    "urn:iso:std:iso:3166",  # Country codes
    "urn:iso:std:iso:3166:-2",  # Country codes
    "urn:iso:std:iso:4217",  # Currency codes
    "urn:iso:std:iso:11073:10101",  # Medical device codes
]

SUPPORTED_CODE_SYSTEMS = [
    "http://snomed.info/sct",
    "http://loinc.org",
    "http://unitsofmeasure.org",
]


class ResourceType:
    CodeSystem: str = "CodeSystem"
    ValueSet: str = "ValueSet"
    ConceptMap: str = "ConceptMap"
    StructureDefinition: str = "StructureDefinition"
    OperationDefinition: str = "OperationDefinition"
    CapabilityStatement: str = "CapabilityStatement"
    SearchParameter: str = "SearchParameter"
    MessageDefinition: str = "MessageDefinition"
    OperationOutcome: str = "OperationOutcome"
    ImplementationGuide: str = "ImplementationGuide"
    StructureMap: str = "StructureMap"
