package cn.muchinfo.rma.global

object ViewEnumUtils {

    /**
     * 合同待审核页面页面审核状态
     * @param status String
     * @return String
     */
    fun getContractStatus(status: String): String {
        var outString = ""
        when (status) {
            "0" -> {
                outString = "未提交"
            }
            "1" -> {
                outString = "待审核"
            }
            "2" -> {
                outString = "执行中"
            }
            "3" -> {
                outString = "正常完结"
            }
            "4" -> {
                outString = "审核拒绝"
            }
            "5" -> {
                outString = "异常完结"
            }
            "6" -> {
                outString = "已撤回"
            }
        }

        return outString
    }

    /**
     * 业务财务管理列表的申请状态
     * @param status String
     * @return String
     */
    fun getBusinessManagementStatus(status: String): String {
        var outString = ""
        when (status) {
            "1" -> {
                outString = "待审核"
            }
            "2" -> {
                outString = "审核通过"
            }
            "3" -> {
                outString = "审核拒绝"
            }
            "4" -> {
                outString = "处理失败"
            }
            "5" -> {
                outString = "已撤回"
            }
        }

        return outString
    }

    fun getContractType(status: String): String {
        return if (status == "1") {
            "采购"
        } else {
            "销售"
        }
    }


    fun getPriceType(type: String): String {
        return when (type) {
            "1" -> {
                "一口价"
            }
            "2" -> {
                "点价"
            }
            else -> {
                "暂定价"
            }
        }
    }

    fun getProductType(type: String): String {
        return when (type) {
            "1" -> {
                "标准仓单"
            }
            "2" -> {
                "等标"
            }
            else -> {
                "非标"
            }
        }
    }

    /**
     * 敞口-现货头寸-现货明细-type
     * @param contracttype String
     * @param logtype String
     * @return String
     */
    fun getSpotPositionType(contracttype: String = "", logtype: String = ""): String {
        return if (contracttype == "1") {
            "采购"
        } else {
            "销售"
        } + if (logtype == "1") {
            "计划"
        } else {
            "合同"
        }
    }

    /**
     * 获取买卖类型
     * @param buyorsell String
     * @return String
     */
    fun getBuyorsellType(buyorsell: String): String {
        return if (buyorsell == "0") {
            "买"
        } else {
            "卖"
        }
    }

    /**
     * 获取开平类型
     * @param channelbuildtype String
     * @return String
     */
    fun getchannelbuildtype(channelbuildtype : String) : String{
        return if (channelbuildtype == "1") {
            "开"
        } else {
            "平"
        }
    }

}