# 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 dk.nsp.mingraviditet.R
    import dk.nsp.util.textmodel.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
            )
        }
    }