package com.abbidot.tracker.bean

import android.os.Parcelable
import com.abbidot.baselibrary.constant.MMKVKey
import com.abbidot.baselibrary.util.MMKVUtil
import com.abbidot.baselibrary.util.Utils
import com.abbidot.tracker.base.BaseDiffBean
import kotlinx.parcelize.Parcelize

/**
 *Created  by .yzq on 2022/2/28/028.
 * @link
 * @description:
 */
@Parcelize
data class PetBean(
    var petId: String,
    var deviceServiceId: String,
    var petName: String,
    var breed: String,
    var shared: Int, //0=没有分享，1=是授权分享的
    var petType: Int, //宠物类别 0=其他 1是狗 2是猫
    var userId: String,
    var imgurl: String,
    var gender: Int,
    var birthdayDate: String,
    var createDate: String,
    var weight: Float,
    var height: Float,
    var labels: String,
    var deviceOutId: String,
    var macID: String,
    var mealType: Int,
    var deviceType: Int,
    var availableOrder: Int,//判断套餐是否可用或过期，1是可用 0不可用
    var deviceId: String
) : Parcelable, BaseDiffBean() {
    constructor() : this(
        "", "", "", "", 0, 1, MMKVUtil.getString(MMKVKey.UserId), "", 0, Utils.formatTime(
            System.currentTimeMillis(), Utils.DATE_FORMAT_PATTERN_CN
        ), "", 0f, 0f, "", "", "", 1, 1, 1, ""
    )

    override fun isSameObject(other: Any): Boolean {
        val oldItem = other as PetBean
        return oldItem.petId == petId
    }

    override fun hasSameContent(other: Any): Boolean {
        val oldItem = other as PetBean
        return oldItem.petName == petName && oldItem.imgurl == imgurl && oldItem.deviceOutId == deviceOutId && oldItem.breed == breed && oldItem.gender == gender && oldItem.birthdayDate == birthdayDate && oldItem.petType == petType && oldItem.weight == weight && oldItem.height == height && oldItem.labels == labels
    }
}
