# JournalSection.kt

    /*
     * The MIT License
     *
     * Original work sponsored and donated by The Danish Health Data Authority (http://www.sundhedsdatastyrelsen.dk)
     *
     * Copyright (C) 2020 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

    import android.os.Parcelable
    import androidx.annotation.DrawableRes
    import androidx.annotation.StringRes
    import dk.nsp.mingraviditet.R
    import dk.nsp.util.TextModel
    import kotlinx.parcelize.Parcelize

    @Parcelize
    enum class JournalSection : Parcelable {
        Measurements, Scans, Screenings, JournalNotes, AroundThePregnancy, OverallAssessment, HealthCare, PersonalData;

        fun getTitle(): TextModel {
            return TextModel.from(
                when (this) {
                    Measurements -> R.string.journal_section_measurements_title
                    Scans -> R.string.journal_section_scans_title
                    Screenings -> R.string.journal_section_screenings_title
                    JournalNotes -> R.string.journal_section_journal_notes_title
                    AroundThePregnancy -> R.string.journal_section_around_the_pregnancy_title
                    OverallAssessment -> R.string.journal_section_overall_assessment_title
                    HealthCare -> R.string.journal_section_health_care_title
                    PersonalData -> R.string.journal_section_personal_data_title
                }
            )
        }

        fun getDescription(): TextModel {
            return TextModel.from(
                when (this) {
                    Measurements -> R.string.journal_section_measurements_description
                    Scans -> R.string.journal_section_scans_description
                    Screenings -> R.string.journal_section_screenings_description
                    JournalNotes -> R.string.journal_section_journal_notes_description
                    AroundThePregnancy -> R.string.journal_section_around_the_pregnancy_description
                    OverallAssessment -> R.string.journal_section_overall_assessment_description
                    HealthCare -> R.string.journal_section_health_care_description
                    PersonalData -> R.string.journal_section_personal_data_description
                }
            )
        }

        @DrawableRes
        fun getIcon(): Int {
            return when (this) {
                Measurements -> R.drawable.ic_measurements
                Scans -> R.drawable.ic_scans
                Screenings -> R.drawable.ic_screenings
                JournalNotes -> R.drawable.ic_journal_notes
                AroundThePregnancy -> R.drawable.ic_around_the_pregnancy
                OverallAssessment -> R.drawable.ic_riskassessment
                HealthCare -> R.drawable.ic_healthcare
                PersonalData -> R.drawable.ic_personal
            }
        }

        fun createJournalSectionCardBindingModel(onClick: () -> Unit): JournalSectionCardBindingModel {
            return JournalSectionCardBindingModel(
                getTitle(),
                getDescription(),
                getIcon(),
                onClick
            )
        }
    }

    @Parcelize
    enum class JournalKeyValueSectionDetailType : Parcelable {
        //Undersøgelses resultater
        ScreeningsBloodtype,
        ScreeningsDiabetes,
        ScreeningsStreptococcusGroupB,
        ScreeningsVitaminD,
        ScreeningsOther,

        // Rundt om graviditeten
        AroundThePregnancyExpectedDateOfBirth,
        AroundThePregnancyAssistedFertility,
        AroundThePregnancyRiskAssessment,
        AroundThePregnancyHealthSection,
        AroundThePregnancyLifestyle,
        AroundThePregnancyWorkEnvironment,

        // Mine sundhedsfaglige under graviditeten
        HealthcareMidwifeOrganization,
        HealthcareBirthplace,
        HealthcareNurse,
        HealthcareGeneralPractitioner,

        // Personlige oplysninger
        PersonalContactInformation,
        PersonalLifeTogetherAndHome,
        PersonalNationalityAndLanguage,
        PersonalRelations;

        @StringRes
        fun getTitle(): Int {
            return when (this) {
                ScreeningsBloodtype -> R.string.journal_section_screenings_bloodtype_item
                ScreeningsDiabetes -> R.string.journal_section_screenings_diabetes_item
                ScreeningsStreptococcusGroupB -> R.string.journal_section_screenings_streptococcus_b_item
                ScreeningsVitaminD -> R.string.journal_section_screenings_d_vitamin_item
                ScreeningsOther -> R.string.journal_section_screenings_other_screenings_item
                AroundThePregnancyExpectedDateOfBirth -> R.string.journal_section_around_the_pregnancy_expected_date_of_delivery_item
                AroundThePregnancyAssistedFertility -> R.string.journal_section_around_the_pregnancy_assisted_fertility_item
                AroundThePregnancyRiskAssessment -> R.string.journal_section_around_the_pregnancy_risk_assessment_item
                AroundThePregnancyHealthSection -> R.string.journal_section_around_the_pregnancy_health_item
                AroundThePregnancyLifestyle -> R.string.journal_section_around_the_pregnancy_lifestyle_item
                AroundThePregnancyWorkEnvironment -> R.string.journal_section_around_the_pregnancy_work_environment_item
                HealthcareMidwifeOrganization -> R.string.journal_section_health_care_midwife_item
                HealthcareBirthplace -> R.string.journal_section_health_care_birthplace_item
                HealthcareNurse -> R.string.journal_section_health_care_nurse_item
                HealthcareGeneralPractitioner -> R.string.journal_section_health_care_general_practitioner_item
                PersonalContactInformation -> R.string.journal_section_personal_data_contact_information_item
                PersonalLifeTogetherAndHome -> R.string.journal_section_personal_data_life_together_and_home_item
                PersonalNationalityAndLanguage -> R.string.journal_section_personal_data_nationality_and_language_item
                PersonalRelations -> R.string.journal_section_personal_data_relatives_item
            }
        }
    }