package com.adealink.weparty.module.playmate.data

import android.os.Parcelable
import com.adealink.weparty.module.widget.form.data.StepField
import com.google.gson.annotations.GsonNullable
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Parcelize
data class PlaymateDetailData(
    @SerializedName("id") val playmateId: String, //技能/商品ID

    @SerializedName("userNo") val uid: String, //用户ID
    @SerializedName("avatar") val avatar: String, //头像
    @SerializedName("nickname") val nickname: String, //昵称
    @SerializedName("age") val age: Int = 0, //年龄
    @SerializedName("gender") val gender: Int = 0, //性别
    @SerializedName("star") val star: Float = 0.0f, //评分
    @SerializedName("area") val area: String = "", //所在地区
    @SerializedName("summary") val summary: String = "", //摘要
    @SerializedName("images") val images: List<String> = emptyList(), //图片列表
    @SerializedName("voiceBar") val voice: String = "", //语音条
    @SerializedName("price") val price: Float, //价格
    @SerializedName("unit") val unit: String, //价格单位
    @SerializedName("labels") val labels: List<String> = emptyList(), //标签
    @SerializedName("categoryName") val categoryName: String, //品类名称
    @SerializedName("categoryIcon") val categoryIcon: String, //品类图标
    @SerializedName("languageNames") val languageNames: List<String> = emptyList(), //语言列表

    @SerializedName("categoryCode") val categoryCode: String = "",
    @SerializedName("orderCount") val orderCount: Int = 0, //订单量
    @SerializedName("online") val online: Boolean = false, //是否在线
    @SerializedName("follow") val follow: Boolean = false, //是否关注
    @SerializedName("distance") val distance: Float, //距离(单位:km)
    @GsonNullable
    @SerializedName("extendFields") val extendFields: List<StepField<*>>? = null //扩展字段
) : Parcelable

@Parcelize
data class PlaymateBusinessData(
    @SerializedName("weekBeanIncome") val weekIncome: Float, //本周金豆收入
    @SerializedName("exposureCountDay") val todayExposure: Long, //今日曝光
    //@SerializedName("visitorCount") val visitor: Long, //访客数,(字段废弃)
    @SerializedName("potentialUserCount") val userPush: Long, //新用户推送
    @SerializedName("playmateOpen") val businessOpen: Boolean, //陪玩师是否营业
) : Parcelable


data class PlaymateExposureReq(
    @SerializedName("list") val playmateId: List<String>,
)

data class PlaymateVisitorReq(
    @SerializedName("id") val uid: String,
)

data class SkillSettingData(
    @SerializedName("id") val id: String,
    @SerializedName("bizCategoryCode") val categoryCode: String,
    @SerializedName("bizCategoryName") val categoryName: String,
    @SerializedName("categoryIcon") val categoryIcon: String,
    @SerializedName("price") val price: Float,
    @SerializedName("unit") val unit: String,
    @SerializedName("open") var open: Boolean
)


const val PLAYMATE_WELCOME_TEXT = 0
const val PLAYMATE_WELCOME_VOICE = 1

enum class SayWelcomeStatus(val status: Int) {
    PENDING_REVIEW(0),
    PASS(1),
    REJECT(2);

    companion object {
        @JvmStatic
        fun map(status: Int): SayWelcomeStatus {
            return entries.find { it.status == status } ?: PENDING_REVIEW
        }

        @JvmStatic
        fun isUnderReview(status: Int): Boolean {
            return status == PENDING_REVIEW.status
        }
    }
}

@Parcelize
data class SayWelcomeData(
    @SerializedName("id") val id: String,
    @SerializedName("type") val type: Int,//0:text, 1:voice
    @SerializedName("status") val status: Int,//0-待审核 1-通过 2-拒绝，CommonApplyStatusConsts 常量

    @GsonNullable
    @SerializedName("reviewReason") val reviewReason: String? = null,//审核原因

    @GsonNullable
    @SerializedName("textContent") val text: String? = null,

    @GsonNullable
    @SerializedName("voiceUrl") val voice: String? = null,
    @SerializedName("voiceDuration") val voiceDuration: Int? = null,

    @GsonNullable
    @SerializedName("itemPosition") var itemPosition: Int? = null
) : Parcelable {
    fun isText(): Boolean {
        return type == 0
    }

    fun isVoice(): Boolean {
        return type == 1
    }
}


data class NotifyPlaymateWelcomeReq(
    @SerializedName("playmateUserNo") val uid: String,
)