package com.lukouguoji.module_base.bean

import dev.utils.app.info.KeyValue

data class UserRoleBean(
    val id: String,
    val password: String,
    val phone: Any,
    // 角色期限 0:长期 1:临时
    val roleTerm: String,
    val roles: List<Role>,
    /**
     * 用户角色：
     * 0:计重员、1:复磅司机、2:仓管主班、3:仓管副班、4:进港理货员、5:进港仓管员、6:接驳司机、7:转运司机
     */
    val userRole: String,
    val username: String,
    val roleName: String
) {

    fun getUserRoleName(): String = when (userRole) {
        "0" -> "计重员"
        "1" -> "复磅司机"
        "2" -> "仓管主班"
        "3" -> "仓管副班"
        "4" -> "进港理货员"
        "5" -> "进港仓管员"
        "6" -> "接驳司机"
        "7" -> "顺货司机"
        "8" -> "监装监卸"
        else -> ""
    }

    fun toKeyValue() = KeyValue(username, id)

}

data class Role(
    val id: String,
    val name: String
) {

    fun toKeyValue(): KeyValue = KeyValue(name, id)

}