# generated by datamodel-codegen:
#   filename:  cell-counting.json
#   timestamp: 2023-10-23T16:36:46+00:00

from __future__ import annotations

from dataclasses import dataclass
from typing import Optional

from allotropy.allotrope.models.shared.definitions.custom import (
    TQuantityValueCell,
    TQuantityValueMicroliter,
    TQuantityValueMicrometer,
    TQuantityValueMillionCellsPerMilliliter,
    TQuantityValueMilliSecond,
    TQuantityValueNanometer,
    TQuantityValuePercent,
    TQuantityValueTODO,
    TQuantityValueUnitless,
)
from allotropy.allotrope.models.shared.definitions.definitions import (
    TDatacubeData,
    TDatacubeStructure,
    TDateTimeValue,
    TStringValue,
)


@dataclass
class DeviceSystemDocument:
    device_identifier: Optional[TStringValue] = None
    model_number: Optional[TStringValue] = None
    device_serial_number: Optional[TStringValue] = None


@dataclass
class DataSystemDocument:
    data_system_instance_identifier: Optional[TStringValue] = None
    file_name: Optional[TStringValue] = None
    UNC_path: Optional[TStringValue] = None
    software_name: Optional[TStringValue] = None
    software_version: Optional[TStringValue] = None
    ASM_converter_name: Optional[TStringValue] = None
    ASM_converter_version: Optional[TStringValue] = None


@dataclass
class SampleDocument:
    sample_identifier: Optional[TStringValue] = None
    batch_identifier: Optional[TStringValue] = None
    sample_role_type: Optional[TStringValue] = None
    location_identifier: Optional[TStringValue] = None


@dataclass
class ImageDocumentItem:
    experimental_data_identifier: Optional[TStringValue] = None
    field_index: Optional[int] = None


@dataclass
class ImageAggregateDocument:
    image_document: Optional[list[ImageDocumentItem]] = None


@dataclass
class DeviceControlDocumentItem:
    device_type: TStringValue
    sample_volume_setting: Optional[TQuantityValueMicroliter] = None
    detection_type: Optional[TStringValue] = None
    excitation_wavelength_setting: Optional[TQuantityValueNanometer] = None
    emission_wavelength_setting: Optional[TQuantityValueNanometer] = None
    illumination_setting: Optional[TQuantityValuePercent] = None
    exposure_duration_setting: Optional[TQuantityValueMilliSecond] = None
    detector_gain_setting: Optional[TStringValue] = None
    fluorescence_tag_setting: Optional[TStringValue] = None
    field_index: Optional[int] = None


@dataclass
class DeviceControlAggregateDocument:
    device_control_document: list[DeviceControlDocumentItem]


@dataclass
class DataProcessingDocument:
    cell_type_processing_method: Optional[TStringValue] = None
    minimum_cell_diameter: Optional[TQuantityValueMicrometer] = None
    maximum_cell_diameter: Optional[TQuantityValueMicrometer] = None
    cell_density_dilution_factor: Optional[TQuantityValueUnitless] = None


@dataclass
class TotalCellDiameterDistributionDataCube:
    label: Optional[str] = None
    cube_structure: Optional[TDatacubeStructure] = None
    data: Optional[TDatacubeData] = None


@dataclass
class ProcessedDataDocument:
    data_processing_document: DataProcessingDocument
    viability__cell_counter_: TQuantityValuePercent
    viable_cell_density__cell_counter_: TQuantityValueMillionCellsPerMilliliter
    total_cell_count: TQuantityValueCell
    total_cell_density__cell_counter_: Optional[
        TQuantityValueMillionCellsPerMilliliter
    ] = None
    dead_cell_density__cell_counter_: Optional[
        TQuantityValueMillionCellsPerMilliliter
    ] = None
    average_total_cell_diameter: Optional[TQuantityValueMicrometer] = None
    average_live_cell_diameter__cell_counter_: Optional[TQuantityValueMicrometer] = None
    average_dead_cell_diameter__cell_counter_: Optional[TQuantityValueMicrometer] = None
    total_cell_diameter_distribution_data_cube: Optional[
        TotalCellDiameterDistributionDataCube
    ] = None
    viable_cell_count: Optional[TQuantityValueCell] = None
    dead_cell_count: Optional[TQuantityValueCell] = None
    average_total_cell_circularity: Optional[TQuantityValueUnitless] = None
    average_viable_cell_circularity: Optional[TQuantityValueUnitless] = None
    fluorescence_tag_positive_cell_count: Optional[TQuantityValueTODO] = None
    fluorescence_tag_positive_cell_density: Optional[TQuantityValueTODO] = None
    fluorescence_tag_positive_cell_percentage: Optional[TQuantityValueTODO] = None


@dataclass
class MeasurementDocumentItem:
    measurement_identifier: TStringValue
    measurement_time: TDateTimeValue
    sample_document: SampleDocument
    device_control_aggregate_document: DeviceControlAggregateDocument
    processed_data_document: ProcessedDataDocument
    image_aggregate_document: Optional[ImageAggregateDocument] = None


@dataclass
class MeasurementAggregateDocument:
    measurement_document: list[MeasurementDocumentItem]


@dataclass
class CellCountingDocumentItem:
    analyst: TStringValue
    measurement_aggregate_document: MeasurementAggregateDocument
    submitter: Optional[TStringValue] = None


@dataclass
class CellCountingAggregateDocument:
    device_system_document: DeviceSystemDocument
    cell_counting_document: list[CellCountingDocumentItem]
    data_system_document: Optional[DataSystemDocument] = None


@dataclass
class Model:
    cell_counting_aggregate_document: CellCountingAggregateDocument
    manifest: str = "http://purl.allotrope.org/manifests/cell-counting/BENCHLING/2023/09/cell-counting.manifest"
