# ObservationTableDataType.kt

    /*
     * The MIT License
     *
     * Original work sponsored and donated by The Danish Health Data Authority (http://www.sundhedsdatastyrelsen.dk)
     *
     * Copyright (C) 2021 The Danish Health Data Authority (http://www.sundhedsdatastyrelsen.dk)
     *
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy of
     * this software and associated documentation files (the "Software"), to deal in
     * the Software without restriction, including without limitation the rights to
     * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
     * of the Software, and to permit persons to whom the Software is furnished to do
     * so, subject to the following conditions:
     *
     *
     * The above copyright notice and this permission notice shall be included in all
     * copies or substantial portions of the Software.
     *
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
     * SOFTWARE.
     */

    package dk.nsp.mingraviditet.ui.main.journal.sections.measurements.table.models.common

    import dk.nsp.mingraviditet.R
    import dk.nsp.util.textmodel.TextModel

    sealed class ObservationTableDataType {
        abstract val title: TextModel
        abstract val defaultCellType: DataTableCellType

        companion object
    }

    sealed class JournalTableClinicalMotherMeasurementType : ObservationTableDataType() {
        object Weight : JournalTableClinicalMotherMeasurementType()
        object BloodPressure : JournalTableClinicalMotherMeasurementType()
        object Urine : JournalTableClinicalMotherMeasurementType()
        object Edema : JournalTableClinicalMotherMeasurementType()
        object PubisMeasurement : JournalTableClinicalMotherMeasurementType()
        object Activity : JournalTableClinicalMotherMeasurementType()

        override val title: TextModel
            get() = TextModel.from(
                when (this) {
                    Weight -> R.string.journal_section_measurements_table_mothers_weight
                    BloodPressure -> R.string.journal_section_measurements_table_blood_pressure
                    Urine -> R.string.journal_section_measurements_table_urine_sample
                    Edema -> R.string.journal_section_measurements_table_edema
                    PubisMeasurement -> R.string.journal_section_measurements_table_pubismeasurement
                    Activity -> R.string.journal_section_measurements_table_appointment
                }
            )

        override val defaultCellType: DataTableCellType
            get() = DataTableCellType.Text

        companion object {
            val orderedDataTypes: List<ObservationTableDataType>
                get() = listOf(
                    Weight,
                    BloodPressure,
                    Urine,
                    Edema,
                    PubisMeasurement,
                    Activity
                )
        }
    }

    sealed class JournalTableClinicalFetusMeasurementType : ObservationTableDataType() {
        object GestationAge : JournalTableClinicalFetusMeasurementType()
        object FetusPresentation : JournalTableClinicalFetusMeasurementType()
        object FetusWeightEstimate : JournalTableClinicalFetusMeasurementType()
        object FetusActivity : JournalTableClinicalFetusMeasurementType()

        override val title: TextModel
            get() = TextModel.from(
                when (this) {
                    GestationAge -> R.string.journal_section_scans_table_gestation_age
                    FetusActivity -> R.string.journal_section_measurements_table_fetus_activity
                    FetusWeightEstimate -> R.string.journal_section_measurements_table_estimated_fetus_weight
                    FetusPresentation -> R.string.journal_section_scans_table_fetus_presentation
                }
            )

        override val defaultCellType: DataTableCellType = DataTableCellType.Text

        companion object {
            val orderedDataTypes: List<ObservationTableDataType>
                get() = listOf(
                    GestationAge,
                    FetusActivity,
                    FetusWeightEstimate,
                    FetusPresentation
                )
        }
    }

    sealed class JournalTableScanFetusMeasurementType : ObservationTableDataType() {
        object GestationAge : JournalTableScanFetusMeasurementType()
        object UlWeight : JournalTableScanFetusMeasurementType()
        object WeightDeviation : JournalTableScanFetusMeasurementType()
        object FetusPresentation : JournalTableScanFetusMeasurementType()

        override val title: TextModel
            get() = TextModel.from(
                when (this) {
                    FetusPresentation -> R.string.journal_section_scans_table_fetus_presentation
                    GestationAge -> R.string.journal_section_scans_table_gestation_age
                    UlWeight -> R.string.journal_section_scans_table_ultrasound_weight
                    WeightDeviation -> R.string.journal_section_scans_table_weight_deviation
                }
            )

        override val defaultCellType: DataTableCellType = DataTableCellType.Text

        companion object {
            val orderedDataTypes: List<ObservationTableDataType>
                get() = listOf(
                    GestationAge,
                    UlWeight,
                    WeightDeviation,
                    FetusPresentation
                )
        }
    }

    sealed class JournalTableScanMotherMeasurementType : ObservationTableDataType() {
        object AmnioticFluid : JournalTableScanMotherMeasurementType()
        object Flow : JournalTableScanMotherMeasurementType()
        object Cervix : JournalTableScanMotherMeasurementType()
        object DVP : JournalTableScanMotherMeasurementType()
    //    object Conclusion : JournalTableScanMotherMeasurementType()
        object Activity : JournalTableScanMotherMeasurementType()

        override val title: TextModel
            get() = TextModel.from(
                when (this) {
                    Activity -> R.string.journal_section_scans_table_appointment
                    AmnioticFluid -> R.string.journal_section_scans_table_amniotic_fluid
                    Cervix -> R.string.journal_section_scans_table_cervix
    //                Conclusion -> R.string.journal_section_scans_table_conclusion
                    DVP -> R.string.journal_section_scans_table_dvp
                    Flow -> R.string.journal_section_scans_table_flow
                }
            )

        override val defaultCellType: DataTableCellType = DataTableCellType.Text

        companion object {
            val orderedDataTypes: List<ObservationTableDataType>
                get() = listOf(
                    AmnioticFluid,
                    Flow,
                    Cervix,
                    DVP,
    //                Conclusion,
                    Activity
                )
        }
    }