package com.adealink.weparty.playmate.findpartner.viewmodel

import com.adealink.frame.mvvm.livedata.ExtMutableLiveData
import com.adealink.frame.mvvm.viewmodel.BaseViewModel
import com.adealink.weparty.module.playmate.data.PlaymateCategoryConditionData
import com.adealink.weparty.module.playmate.data.PlaymateCategoryData
import com.adealink.weparty.playmate.findpartner.data.FindPartnerPage
import com.adealink.weparty.ui.category.data.CategoryListTitleData

class FindPartnerViewModel : BaseViewModel() {


    val dismissLD = ExtMutableLiveData<Unit>()
    fun dismiss() {
        dismissLD.send(Unit)
    }

    val pageLD = ExtMutableLiveData<FindPartnerPage>()

    fun showPage(page: FindPartnerPage) {
        pageLD.send(page)
    }

    val categoryTitleLD = ExtMutableLiveData<List<CategoryListTitleData>>()
    fun setCategoryList(titleList: List<CategoryListTitleData>) {
        categoryTitleLD.send(titleList)
    }


    private var allCategoryCondition = mapOf<String, PlaymateCategoryConditionData>()
    fun setCondition(condition: Map<String, PlaymateCategoryConditionData>) {
        this.allCategoryCondition = condition
    }

    fun getCondition(code: String?): PlaymateCategoryConditionData? {
        code ?: return null
        return allCategoryCondition[code]
    }

    val firstCategoryCodeLD = ExtMutableLiveData<String?>()
    fun selectFirstCode(code: String?) {
        firstCategoryCodeLD.send(code)
    }


    val selectCategoryLD = ExtMutableLiveData<PlaymateCategoryData>()
    fun selectCategory(category: PlaymateCategoryData) {
        selectCategoryLD.send(category)
    }
}