package com.remax.visualnovel.entity.response

import android.os.Parcelable
import com.remax.visualnovel.entity.request.HeartbeatRelation
import com.remax.visualnovel.extension.calculateAge
import com.remax.visualnovel.extension.getNimAccountId
import kotlinx.parcelize.Parcelize

/**
 * Created by HJW on 2025/7/17
 */
@Parcelize
data class Character(
    var aiId: String? = null,
    var userId: String? = null,
    var sex: Int? = null, // 0,男;1,女;2,自定义
    var permission: Int? = null, //权限 1: 公开 2：私密
    var nickname: String? = null,
    var idCard: String? = null,
    var headImg: String? = null,
    var birthday: Long? = null,
    var showBirthday: Long? = null,
    var roleCode: String? = null,
    var roleName: String? = null,
    var characterCode: String? = null,
    var characterName: String? = null,
    var tagCode: String? = null,
    var tagName: String? = null,
    var introduction: String? = null, // 人物简介 >= 10 字符 <= 300 字符
    var imageUrl: String? = null,
    var homeImageUrl: String? = null, // 主页头图
    var imageWidth: Int? = null,
    var imageHeight: Int? = null,
    var aiUserExt: CharacterExt? = null,
    var liked: Boolean? = null, //是否点过赞

    var likedNum: Long? = null,
    var chatNum: Long? = null,
    var conversationNum: Long? = null,
    var coinNum: Long? = null,

    //在IM中用
    val dialoguePrologue: String? = null,
    val dialoguePitch: String? = null,
    val dialogueSpeechRate: String? = null,
    val voiceType: String? = null,
    var backgroundImg: String? = null,
    var isDefaultBackground: Boolean? = null,
    var isMember: Boolean? = null,
    var isHaveChatted: Boolean? = null, //是否聊过天
    var isDelChatted: Boolean? = null, //是否删除过会话
    var isAutoPlayVoice: Int? = null,  //自动播放语音开关 1：开 0：关
    var aiUserHeartbeatRelation: HeartbeatRelation? = null,
    var chatBubble: ChatBubble? = null,

    //排行榜使用
    var rankNo: Int? = null,
    var heartbeatValTotal: Double? = null,
    var giftCoinNum: Int? = null,

    //首页滑动卡片使用
    var isLimit: Boolean? = null,
    var likedCount: Long? = null,
    var heartbeatVal: Double? = null,
    var character: String? = null,
    var role: String? = null,
    var tag: String? = null,
    var isSecret: Boolean? = null,
    var albumList: List<Album>? = null,

    ) : Parcelable {
    companion object {
        const val UM_FREE = 1
        const val UM_PAID = 2
    }

    val age: Int
        get() = (birthday ?: 0L).calculateAge()

    val nimAccountId: String
        get() = aiId.getNimAccountId(true)
}

@Parcelize
data class CharacterExt(
    var profile: String? = null,  //人物设定    >= 10 字符 <= 4000 字符
    var userProfile: String? = null,  //人物设定    >= 10 字符 <= 4000 字符
    var dialogueStyle: String? = null,  // 对话风格 >= 10 字符 <= 300 字符
    var userDialogueStyle: String? = null,  // 对话风格 >= 10 字符 <= 300 字符
    var dialoguePrologue: String? = null, // 开场白 >= 10 字符 <= 150 字符
    var dialogueTimbreCode: String? = null, // 对话音色Code
    var dialoguePitch: String? = null, // 对话-音高
    var dialogueSpeechRate: String? = null, // 对话-语速
    var imageStyleCode: String? = null, //形象风格code
    var imageDesc: String? = null, //形象描述 >= 10 字符  <= 500 字符
    var imageReferenceUrl: String? = null, // 形象参考
) : Parcelable