from __future__ import annotations

from allotropy.allotrope.models.adm.cell_counting.benchling._2023._11.cell_counting import (
    Model,
)
from allotropy.allotrope.schema_mappers.adm.cell_counting.benchling._2023._11.cell_counting import (
    Data,
    Mapper,
)
from allotropy.named_file_contents import NamedFileContents
from allotropy.parsers.beckman_vi_cell_blu.vi_cell_blu_reader import ViCellBluReader
from allotropy.parsers.beckman_vi_cell_blu.vi_cell_blu_structure import create_data
from allotropy.parsers.release_state import ReleaseState
from allotropy.parsers.vendor_parser import VendorParser


class ViCellBluParser(VendorParser):
    @property
    def display_name(self) -> str:
        return "Beckman Vi-Cell BLU"

    @property
    def release_state(self) -> ReleaseState:
        return ReleaseState.RECOMMENDED

    def to_allotrope(self, named_file_contents: NamedFileContents) -> Model:
        return self._get_model(
            data=create_data(ViCellBluReader.read(named_file_contents)),
            filename=named_file_contents.original_file_name,
        )

    def _get_model(self, data: Data, filename: str) -> Model:
        mapper = Mapper(self.get_asm_converter_name(), self._get_date_time)
        return mapper.map_model(data, filename)
