"""Enums and constants for the DICOM MCP server."""

from enum import Enum


class ResponseFormat(str, Enum):
    """Output format for tool responses."""

    MARKDOWN = "markdown"
    JSON = "json"


class SequenceType(str, Enum):
    """Common MRI sequence types."""

    DIXON = "dixon"
    T1_MAPPING = "t1_mapping"
    MULTI_ECHO_GRE = "multi_echo_gre"
    SPIN_ECHO_IR = "spin_echo_ir"
    T1 = "t1"
    T2 = "t2"
    FLAIR = "flair"
    DWI = "dwi"
    LOCALIZER = "localizer"
    UNKNOWN = "unknown"


# Tag names for common DICOM attributes
COMMON_TAGS = {
    "patient_info": [
        (0x0010, 0x0010),  # PatientName
        (0x0010, 0x0020),  # PatientID
        (0x0010, 0x0030),  # PatientBirthDate
        (0x0010, 0x0040),  # PatientSex
    ],
    "study_info": [
        (0x0008, 0x0020),  # StudyDate
        (0x0008, 0x0030),  # StudyTime
        (0x0020, 0x000D),  # StudyInstanceUID
        (0x0008, 0x1030),  # StudyDescription
    ],
    "series_info": [
        (0x0008, 0x0060),  # Modality
        (0x0020, 0x000E),  # SeriesInstanceUID
        (0x0008, 0x103E),  # SeriesDescription
        (0x0020, 0x0011),  # SeriesNumber
    ],
    "image_info": [
        (0x0028, 0x0010),  # Rows
        (0x0028, 0x0011),  # Columns
        (0x0028, 0x0008),  # NumberOfFrames
        (0x0020, 0x0013),  # InstanceNumber
        (0x0008, 0x0008),  # ImageType
    ],
    "acquisition": [
        (0x0018, 0x0020),  # ScanningSequence
        (0x0018, 0x0021),  # SequenceVariant
        (0x0018, 0x0023),  # MRAcquisitionType
        (0x0018, 0x0080),  # RepetitionTime
        (0x0018, 0x0081),  # EchoTime
        (0x0018, 0x0082),  # InversionTime
        (0x0018, 0x1314),  # FlipAngle
    ],
    "manufacturer": [
        (0x0008, 0x0070),  # Manufacturer
        (0x0008, 0x1090),  # ManufacturerModelName
        (0x0018, 0x1020),  # SoftwareVersions
    ],
    "equipment": [
        (0x0008, 0x1010),  # StationName
        (0x0018, 0x1000),  # DeviceSerialNumber
        (0x0008, 0x0080),  # InstitutionName
        (0x0008, 0x1040),  # InstitutionalDepartmentName
        (0x0018, 0x0087),  # MagneticFieldStrength
        (0x0018, 0x1250),  # ReceiveCoilName
        (0x0018, 0x1251),  # TransmitCoilName
    ],
    "geometry": [
        (0x0028, 0x0030),  # PixelSpacing
        (0x0018, 0x0050),  # SliceThickness
        (0x0018, 0x0088),  # SpacingBetweenSlices
        (0x0020, 0x1041),  # SliceLocation
        (0x0020, 0x0032),  # ImagePositionPatient
        (0x0020, 0x0037),  # ImageOrientationPatient
    ],
    "pixel_data": [
        (0x0028, 0x0100),  # BitsAllocated
        (0x0028, 0x0101),  # BitsStored
        (0x0028, 0x0102),  # HighBit
        (0x0028, 0x0103),  # PixelRepresentation
        (0x0028, 0x1050),  # WindowCenter
        (0x0028, 0x1051),  # WindowWidth
    ],
}

VALID_TAG_GROUPS = sorted(COMMON_TAGS.keys())
