package cn.muchinfo.rma.global

import com.blankj.utilcode.util.TimeUtils

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 {
            "平"
        }
    }

    /**
     * 期货成交单单据类型
     * buyOrSell 方向 - 0:买 1:卖
     * channelbuildtype 委托单据类型 0:无 1:建仓 2:平仓
     */
    fun getDealOrderType(buyOrSell : String,channelbuildtype : String) : String{
        var str = ""
        if (buyOrSell == "0"){
            if (channelbuildtype == "1"){
                str = "买多"
            }else{
                str = "平买"
            }
        }else{
            if (channelbuildtype == "1"){
                str = "卖空"
            }else{
                str = "平卖"
            }
        }

        return str
    }

    /**
     * 期货成交单成交类型
     */
    fun getchanneloperatetype(channeloperatetype : String) : String{
        var str = ""
        if (channeloperatetype == "1"){
            str = "正常委托"
        }else if (channeloperatetype == "2"){
            str = "斩仓委托"
        }else if(channeloperatetype == "3"){
            str = "强平委托"
        }
        return str
    }


    /**
     * 期货交易的委托状态
     */
    fun getchannelinnerorderstatus(status : String) :String{
        var str = "--"
        if (status == "1"){
            str = "委托请求"
        }else if (status == "2"){
            str = "冻结成功"
        }else if (status == "3"){
            str = "委托失败"
        }else if (status == "4"){
            str = "委托部成部失败"
        }else if (status == "5"){
            str = "委托成功"
        }else if (status == "6"){
            str = "全部撤销"
        }else if (status == "7"){
            str = "部成部撤"
        }else if (status == "8"){
            str = "部成部撤部失败"
        }else if (status == "9"){
            str = "全部成交"
        }

        return str
    }
}