package com.dlc.eboard.dummy

import com.dlc.eboard.common.SensorEnum
import com.dlc.eboard.mqtt.entity.BulletinBoardEntity
import com.dlc.eboard.mqtt.entity.EmergencyEntity
import com.rc.httpcore.vo.response.LabBulletinBoardVo
import com.rc.httpcore.vo.response.LaboratoryVo
import kotlin.random.Random

/**
 * info
 *
 * @author ReiChin_
 */
object DummyData {

    fun dummyLaboratoryVo(): LaboratoryVo {
        return LaboratoryVo().apply {
            address = "安全生产检测中心 三楼 317 教二"
            adminName = "李老师"
            adminPhone = null
            dangerName = "一般危险级" // 1高危险级,2较高危险级,3中危险级,4一般危险级
            dangerLevel = "4"
            deptName = null
            online = null
            outCheck = arrayListOf("打扫实验室区域", "仪器断电整理", "无私拉乱接线")
            subClass = "美术"
            subId = "10"
            subName = "测试实验室02"
            signMap = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp01%2F1ZZP044191A4-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1654593008&t=50fd137046533cfcd88aae7a9f205b34"
            videoCover = ""
            operationGuide = "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.2008php.com%2F09_Website_appreciate%2F10-07-11%2F1278861720_g.jpg&refer=http%3A%2F%2Fwww.2008php.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1654593008&t=71e2cfc724c7a42bc9ec89ec9217aab5"
        }
    }

    fun dummyLabBulletinBoardVos(): ArrayList<LabBulletinBoardVo> {
        return ArrayList<LabBulletinBoardVo>().apply {
            add(LabBulletinBoardVo().apply {
                describe = "氧气"
                funNum = "o2"
                formatVal = "${Random.nextInt(15, 25)}.9%"
            })
            add(LabBulletinBoardVo().apply {
                describe = "烟雾"
                funNum = "yanwu"
                formatVal = "${Random.nextInt(0, 2)}"
            })
            add(LabBulletinBoardVo().apply {
                describe = "温度"
                funNum = "wendu"
                formatVal = "${Random.nextInt(10, 50)}.1℃"
            })
            add(LabBulletinBoardVo().apply {
                describe = "粉尘"
                funNum = "fenchen"
                formatVal = "${Random.nextInt(0, 3)}mg/m3"
            })
            add(LabBulletinBoardVo().apply {
                describe = "湿度"
                funNum = "shidu"
                formatVal = "${Random.nextInt(10, 33)}.5%RH"
            })
            add(LabBulletinBoardVo().apply {
                describe = "甲烷"
                funNum = "jiawan"
                formatVal = "${Random.nextInt(1, 5)}%"
            })
            add(LabBulletinBoardVo().apply {
                describe = "大气压"
                funNum = "daqiya"
                formatVal = "${Random.nextInt(1, 5)}kPa"
            })
            add(LabBulletinBoardVo().apply {
                describe = "一氧化碳"
                funNum = "co"
                formatVal = "${Random.nextInt(1, 5)}.1%"
            })
        }
    }

    fun dummyBulletinBoardWaring(): List<LabBulletinBoardVo> {
        val sensorEnums = SensorEnum.values()
        return ArrayList<LabBulletinBoardVo>().apply {
            val until = Random.nextInt(sensorEnums.size)
            for (i in 0..until) {
                add(LabBulletinBoardVo().apply {
                    funNum = sensorEnums[Random.nextInt(sensorEnums.size)].funNum
                })
            }
        }
    }

    fun dummyBulletinBoardEntity(defStatuses: List<LabBulletinBoardVo> = dummyLabBulletinBoardVos())
            : BulletinBoardEntity {
        return BulletinBoardEntity().apply {
            data = BulletinBoardEntity.Data().apply {
                functionStatuses = defStatuses
                subId = functionStatuses.size.toString()
            }
        }
    }

    fun dummyBulletinBoardEntityWaring(): BulletinBoardEntity {
        return dummyBulletinBoardEntity(dummyBulletinBoardWaring())
    }

    fun dummyEmergencyEntity(): EmergencyEntity {
        return EmergencyEntity().apply {
            data = EmergencyEntity.Data().apply {
                context = "实验室发生突发情况，请大家紧急撤离！"
                type = 1
            }
        }
    }

}