import { getItemEnumName } from '@/services/bus/allEnum';
import * as EnumType from './enumCommon';

/**
 * 获取证件类型枚举名称
 * @param enumdicid 
 * @returns 
 */
export function getCardTypeEnumItemName(enumdicid: number): string {
    return getItemEnumName('certificatetype', enumdicid)
}

/**
 *获取仓登录状态枚举名称
 */
export function getLoginStatusEnumItemName(enumdicid: number): string {
    return getItemEnumName('loginstatus', enumdicid)
}

/**
 *获取单位枚举名称
 */
export function getGoodsUnitEnumItemName(enumdicid: number): string {
    return getItemEnumName('goodsunit', enumdicid)
}

/**
 *获取仓库类型枚举名称
 */
export function getWarehouseTypeEnumItemName(enumdicid: number): string {
    return getItemEnumName('warehouseinfoType', enumdicid)
}

/**
 *获取币种类型枚举名称
 */
export function getPayCurrencyTypeEnumItemName(enumdicid: number): string {
    return getItemEnumName('paycurrency', enumdicid)
}

/**
 *获取套保计划类型枚举名称
 */
export function getSpotContractTypeEnumItemName(enumdicid: number): string {
    return getItemEnumName('spotContractType', enumdicid)
}



/****************  页面枚举  *******************/
/**
 * 获取客户资料状态
 * @param state
 */
export function getStatusName(state: number): string {
    let result = "--";
    switch (state) {
        case 1:
            result = "待激活";
            break
        case 2:
            result = "待审核";
            break
        case 3:
            result = "待复审";
            break
        case 4:
            result = "正常";
            break
        case 5:
            result = "审核拒绝";
            break
        case 6:
            result = "停用（注销）";
            break
        case 7:
            result = "注销（删除）";
            break
    }
    return result
}

/**
 * 网上开户表里面的状态枚举
 * @param state
 */
export function getWSKHStatusName(state: number): string {
    let result = "--";
    switch (state) {
        case 1:
            result = "未提交";
            break
        case 2:
            result = "待初审";
            break
        case 3:
            result = "初审拒绝";
            break
        case 4:
            result = "待复审";
            break
        case 5:
            result = "复审拒绝";
            break
        case 6:
            result = "测评不通过";
            break
    }
    return result
}

/**
 * 获取现货品种状态
 * @param type :未激活 1:正常
 */
export function getValidName(type: number) {
    let result = "--";
    switch (type) {
        case 0:
            result = "未激活";
            break
        case 1:
            result = "正常";
            break
    }
    return result
}

/**
 * 定价类型 - 1:一口价 2:点价 3:暂定价
 * @param pricetype 定价类型
 */
export function getPriceTypeName(pricetype: number): string {
    let result = "--";
    switch (pricetype) {
        case 1:
            result = "一口价";
            break
        case 2:
            result = "点价";
            break
        case 3:
            result = "暂定价";
            break
    }
    return result
}

/**
 * 现货合同状态返回
 * @param state
 * //合同状态 - number;
 //0:未提交 1:待审核 2:执行中 3:正常完结 4:审核拒绝 5:异常完结 6:已撤回
 */
export function getContractStatusName(state: number): string {
    let result = "--";
    switch (state) {
        case 0:
            result = "未提交";
            break;
        case 1:
            result = "待审核";
            break
        case 2:
            result = "执行中";
            break
        case 3:
            result = "正常完结";
            break
        case 4:
            result = "审核拒绝";
            break
        case 5:
            result = "异常完结";
            break
        case 6:
            result = "已撤回";
            break
    }
    return result
}

/**
 * 业务类型返回 业务类型 1-套保 2-套利
 * @param state
 */
export function getBizTypeName(state: number): string {
    let result = "--";
    switch (state) {
        case 1:
            result = "套保";
            break
        case 2:
            result = "套利";
            break
    }
    return result
}

/**
 * 获取合同类型名称 现货合同类型 - 1:采购 -1:销售
 */
export function getContractTypeName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "采购"
            break;
        case -1:
            result = "销售"
            break;
    }
    return result
}

/**
 * 业务审核-点价-状态
 * @param type 申请状态 - 1:待审核 2:审核通过 3:审核拒绝 4:处理失败 5:已撤回
 */
export function getApplyStatusName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "待审核";
            break
        case 2:
            result = "审核通过";
            break
        case 3:
            result = "审核拒绝";
            break
        case 4:
            result = "处理失败";
            break
        case 5:
            result = "已撤回";
            break
    }
    return result
}

/**
 * 千海金-提货申请-状态
 * @param type 1:备货中 2:待取货(自提) 3:已取货(自提) 4:待收货(邮寄) 5:已收货(邮寄) 6:自动收货(邮寄) 7:已拒绝 8:已撤销
 */
export function getPickUpStateName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "备货中";
            break
        case 2:
            result = "待取货";
            break
        case 3:
            result = "已取货";
            break
        case 4:
            result = "待收货";
            break
        case 5:
            result = "已收货";
            break
        case 6:
            result = "自动收货";
            break
        case 7:
            result = "已拒绝";
            break
        case 8:
            result = "已撤销";
            break
    }
    return result
}

/**
 * 千海金-收货方式
 * @param type  2:自提 3:配送(邮寄)
 */
export function getTakeStateName(type: number): string {
    let result = "--";
    switch (type) {
        case 2:
            result = "自提";
            break
        case 3:
            result = "配送(邮寄)";
            break
    }
    return result
}

/**
 * 千海金-策略状态
 * @param type 1:正常 2:暂停 3:终止
 */
export function getRegularStateName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "正常";
            break
        case 2:
            result = "暂停";
            break
        case 3:
            result = "终止";
            break
    }
    return result
}

//1:待确认 2:已确认 3:确认拒绝 4:已支付保证金 5:已激活 6:已违约 7:到期结束 8:延期结束 9:违约结束 10:已注销 11:已关闭 99:未提交
export function getContractName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "待确认";
            break
        case 2:
            result = "已确认";
            break
        case 3:
            result = "确认拒绝";
            break
        case 4:
            result = "已支付保证金";
            break
        case 5:
            result = "已激活";
            break
        case 6:
            result = "已违约";
            break
        case 7:
            result = "到期结束";
            break
        case 8:
            result = "延期结束";
            break
        case 9:
            result = "违约结束";
            break
        case 10:
            result = "已注销";
            break
        case 11:
            result = "已关闭";
            break
        case 99:
            result = "未提交";
            break
    }
    return result
}

export function getFinancingStatus(status: number, price: String) : String{
    let result = "--";
    switch (status) {
        case 1:
            result = "正常";
            break
        case 2:
            result = "预警"
            break
        case 3:
            result = "支付尾款" + price + "元";
            break
    }
    return result;
}


//委托状态 - 1： 委托请求 2：待冻结 3：委托成功 4： 委托失败 5：配对成功 6： 已撤销 7：部分成交 8：已成交 9：部成部撤 10：成交失败 11：已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)
export function getOrderStatusName(type: number): string {
    let result = "--";
    switch (type) {
        case 1:
            result = "委托请求";
            break
        case 2:
            result = "待冻结";
            break
        case 3:
            result = "委托成功";
            break
        case 4:
            result = "委托失败";
            break
        case 5:
            result = "配对成功";
            break
        case 6:
            result = "已撤销";
            break
        case 7:
            result = "部分成交";
            break
        case 8:
            result = "已成交";
            break
        case 9:
            result = "部成部撤";
            break
        case 10:
            result = "成交失败";
            break
        case 11:
            result = "已拒绝";
            break
        case 12:
            result = "经过摘牌";
            break
        case 13:
            result = "冻结成功";
            break
        case 14:
            result = "通道已撤";
            break
        case 15:
            result = "通道部成部撤";
            break
        case 16:
            result = "成交失败违约";
            break
        case 17:
            result = "冻结PD成功";
            break
        case 18:
            result = "冻结PD失败";
            break
        case 19:
            result = "冻结能量成功";
            break
        case 20:
            result = "冻结能量失败";
            break
        case 21:
            result = "预约已报价";
            break
        case 22:
            result = "过期未付";
            break
        case 23:
            result = "优惠券处理中";
            break
    }
    return result
}

/**
 * 中文weekday
 * @param type
 */
export function getWeekName(type: string): string {
    let result = "--";
    switch (type) {
        case "1":
            result = "周一";
            break
        case "2":
            result = "周二";
            break
        case "3":
            result = "周三";
            break
        case "4":
            result = "周四";
            break
        case "5":
            result = "周五";
            break
    }
    return result
}


/**
 * 获取对应协议枚举对应名
 * @param type 
 * @returns 
 */
export function getAgreementTypeName(type: EnumType.AgreementType): string {
    let result = '--'
    switch (type) {
        case EnumType.AgreementType.register:
            result = '注册'
            break
        case EnumType.AgreementType.login:
            result = '登录'
            break
        case EnumType.AgreementType.trade:
            result = '交易'
            break
    }
    return result
}

/**
 * 获取协议状态
 * @param isvalid
 */
export function getAgreementStatus(isvalid: number): string {
    let result = '--'
    switch (isvalid) {
        case 1:
            result = '正常'
            break
        case 2:
            result = '停用'
            break
        case 3:
            result = '注销'
            break
    }
    return result
}

/**
 * 持仓方向
 * @param buyOrSell
 */
export function getBuyOrSellName(buyorsell: number): string {
    let result = '--'
    switch (buyorsell) {
        case 0:
            result = '买'
            break
        case 1:
            result = '卖'
            break
    }
    return result
}

/**
 * 变更流水类型
 * 1:套保比率变更 2:套利比率变更
 */
export function getChangeLogType(changelogtype: number) {
    let result = '--'
    switch (changelogtype) {
        case 1:
            result = '套保比率'
            break
        case 2:
            result = '套利比率'
            break
    }
    return result
}