package com.za.bean.db

import androidx.compose.ui.graphics.Color
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "change_battery_photo")
data class ChangeBatteryPhoto(
    //图片id
    @PrimaryKey(autoGenerate = true)
    var id: Long? = null,

    // 流程节点
    var taskNode: Int? = null,

    //图片描述
    var imageDescription: String? = null,

    //图片标题
    var imageTitle: String? = null,

    //标签
    var tag: String? = null,

    // 是否必拍 0 非必拍 1必拍
    var doHaveFilm: Int? = null,

    //封面地址
    var photoUrl: String? = null,

    //图片名称
    var photoName: String? = null,

    //图片类型
    var photoType: Int? = null, //1 走单照片 2 工单照片  3更换电瓶照片

    //创建日期
    var createTime: String? = null,

    var numbering: String? = null, //图片编号

    var recognizeType: Int? = null, //ocr识别类型 0 无 1车牌号 2车架号

    var photoTip: String? = null, //拍摄提示

    var photoPath: String? = null, //照片路径

    var photoContract: String? = null, //对比照

    var photoNum: Int = 1, //对比照

    var mustPhoto: Boolean = false, //是否必拍照片

    var photoStatus: Int? = null, // 0 未上传 1 准备上传 2 已上传 3 上传失败 4 上传中 5 照片不符合条件 6 照片缺失地址信息  7 ocr车架号识别出错

    var uploadedPath: String? = null,

    var photoInfo: String? = null,

    var index: Int? = null,

    var userOrderId: Int? = null,

    var taskId: Int? = null,

    var taskCode: String? = null) {
    fun convertPhotoStatusStr(status: Int): String {
        return when (status) {
            2 -> "已上传"
            3 -> "上传失败"
            4 -> "上传中"
            5 -> "照片不符合条件"
            6 -> "照片缺失地址信息"
            7 -> "车架号识别出错"
            else -> ""
        }
    }

    fun getPhotoStatusColor(): Color {
        return when (this.photoStatus) {
            1 -> Color(0xFF2DBBF9)
            2 -> Color(0xFF32CD32)
            3 -> Color.Red
            4 -> Color(0xFF2DBBF9)
            5 -> Color.Red
            6 -> Color.Red
            else -> Color(0xFF2DBBF9)
        }
    }
}
