# generated by datamodel-codegen:
#   filename:  cell-culture-analyzer.json
#   timestamp: 2023-09-21T17:20:28+00:00

from __future__ import annotations

from dataclasses import dataclass
from typing import Optional, Union

from allotropy.allotrope.models.shared.definitions.custom import (
    TNullableQuantityValueCell,
    TNullableQuantityValueGramPerLiter,
    TNullableQuantityValueMicrometer,
    TNullableQuantityValueMillimeterOfMercury,
    TNullableQuantityValueMillimolePerLiter,
    TNullableQuantityValueMillionCellsPerMilliliter,
    TNullableQuantityValueMilliOsmolesPerKilogram,
    TNullableQuantityValueOpticalDensity,
    TNullableQuantityValuePercent,
    TNullableQuantityValuePH,
    TNullableQuantityValueTODO,
    TNullableQuantityValueUnitPerLiter,
)
from allotropy.allotrope.models.shared.definitions.definitions import (
    TDateTimeValue,
    TStringValue,
)


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


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


@dataclass
class AnalyteDocumentItem:
    analyte_name: TStringValue
    molar_concentration: Optional[
        Union[
            TNullableQuantityValueMillimolePerLiter,
            TNullableQuantityValueGramPerLiter,
            TNullableQuantityValueUnitPerLiter,
        ]
    ] = None


@dataclass
class AnalyteAggregateDocument:
    analyte_document: Optional[list[AnalyteDocumentItem]] = None


@dataclass
class MeasurementDocumentItem:
    sample_document: SampleDocument
    measurement_time: TDateTimeValue
    analyte_aggregate_document: AnalyteAggregateDocument
    pco2: Optional[TNullableQuantityValueMillimeterOfMercury] = None
    co2_saturation: Optional[TNullableQuantityValuePercent] = None
    po2: Optional[TNullableQuantityValueMillimeterOfMercury] = None
    o2_saturation: Optional[TNullableQuantityValuePercent] = None
    optical_density: Optional[TNullableQuantityValueOpticalDensity] = None
    pH: Optional[TNullableQuantityValuePH] = None
    osmolality: Optional[TNullableQuantityValueMilliOsmolesPerKilogram] = None
    viability__cell_counter_: Optional[TNullableQuantityValuePercent] = None
    total_cell_density__cell_counter_: Optional[
        TNullableQuantityValueMillionCellsPerMilliliter
    ] = None
    viable_cell_density__cell_counter_: Optional[
        TNullableQuantityValueMillionCellsPerMilliliter
    ] = None
    average_live_cell_diameter__cell_counter_: Optional[
        TNullableQuantityValueMicrometer
    ] = None
    average_total_cell_diameter__cell_counter_: Optional[
        TNullableQuantityValueMicrometer
    ] = None
    total_cell_diameter_distribution__cell_counter_: Optional[
        TNullableQuantityValueTODO
    ] = None
    viable_cell_count__cell_counter_: Optional[TNullableQuantityValueCell] = None
    total_cell_count__cell_counter_: Optional[TNullableQuantityValueCell] = None


@dataclass
class MeasurementAggregateDocument:
    measurement_identifier: TStringValue
    analyst: TStringValue
    device_system_document: DeviceSystemDocument
    measurement_document: list[MeasurementDocumentItem]
    data_processing_time: Optional[TDateTimeValue] = None


@dataclass
class Model:
    measurement_aggregate_document: Optional[MeasurementAggregateDocument] = None
    manifest: str = "http://purl.allotrope.org/manifests/cell-culture-analyzer/BENCHLING/2023/09/cell-culture-analyzer.manifest"
