package com.friday.custody.enums;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum DaasDataTypeEnum {

    DIC_DIR("dicDir","数据字典目录"),
    PUBLIC_DATA_DIR("publicDataDir","公共数据目录"),
    TENANT("addTenant", "新增租户"),
    AUTH("auth","租户授权"),
    //公共数据内容
    PB_FUND_INDEX_DAILY_QUOTE_DATA("fundIndexDailyQuoteData","基金行情指数"),
    //数据字典内容
    DIC_FUND_ORGANIZATION_FORM("fundOrganizationForm", "基金组织形式"),
    DIC_FUND_TYPE("fundType", "基金类型"),
    DIC_FUND_OPERATION_FORM("fundOperationForm","基金运作方式"),
    DIC_PRODUCT_STATUS("productStatus", "产品状态"),
    DIC_DURATION_TYPE("durationType", "存续期类型"),
    DIC_SETTLEMENT_MODE("settlementMode", "场内结算模式"),
    DIC_SERVICE_MODEL("serviceModel", "服务模式"),
    DIC_CUST_TYPE_CSDC("customerCsdc","客户类型证件类型-中登报送的客户类型"),
    DIC_IDENTITY_TYPE_CSDC("identityCsdc","客户类型证件类型-中登报送的个人/机构/产品的证件类型"),
    DIC_CURRENCY("currency","币种"),
    DIC_FUND_CLASSIFICATION_LOGO("fundClassificationLogo", "基金分级标识"),
    DIC_DIVIDEND_WAY("dividendWay", "分红方式"),
    DIC_PAYMENT_DIRECTION("paymentDirection", "收付方向"),
    DIC_SELLER("seller" , "销售商"),
    DIC_BUSINESS_NAME("businessName","业务类型"),
    DIC_CONFIRM_STATUS("confirmStatus","确认状态"),
    DIC_REVIEW_STATUS("reviewStatus","复核状态"),
    DIC_ACCOUNT_STATUS("accountStatus","账户状态"),
    DIC_ACCRUAL_WAY("accrualWay", "计提方式"),
    DIC_BANK_CODE("bankCode","银行编码"),
    DIC_HANDLE_TYPE("handleType","处理类型"),
    DIC_PAYMENT_WAY("paymentWay", "收费方式"),
    DIC_SHARE_ADJUST("shareAdjust", "份额调整原因"),
    DIC_TA_LAUNCH_FLAG("taLaunchFlag","TA发起标志"),
    DIC_TA_TRANSACTION_CONFIRM_ATION_DAYS("taLaunchFlag","TA交易确认天数"),
    DIC_PRIVATE_FUND_TYPE("privateFundType", "私募基金类型"),
    DIC_ACCOUNT_TYPE("accountType", "账户类型"),
    DIC_SHARE_SOURCE("shareSource", "份额来源"),
    DIC_TYPE_OF_OPEN_DAY("typeOfOpenDay", "开放日类型"),
    DIC_OPEN_STATE("openState", "开放状"),
    DIC_MATCH_STATUS("matchStatus","匹配状态"),
    DIC_RETURN_VISIT_STATUS("returnVisitStatus", "回访状态"),
    DIC_ORDER_TRANSACTION_STATUS("orderTransactionStatus", "订单交易状态"),
    DIC_ORDER_STATUS("orderStatus", "订单状态"),
    DIC_TYPES_OF_FEE("typesOfFee", "费用类型"),
    DIC_SELLER_STATUS("sellerStatus","销售商状态"),
    DIC_TYPE_OF_SELLER("typeOfSeller", "销售商类型"),
    DIC_TRUST("trust","托管人"),
    DIC_EXCHANGE_CODE("exchangeCode","交易所"),
    DIC_MARKETFLAG("marketFlag","市场标识"),
    DIC_REFINANCING_MODE("refinancingMode","再融资方式"),
    DIC_PROJECT_PROGRESS("projectProgress","项目进度"),

    //标准表
    FUND_INFO("1", "基金产品信息表"),
    INVESTOR_INFO("2","基金出资人信息表"),
    FUND_NET_VALUE_INFO("3","基金净值信息表"),
    CUST_SHARE_INFO("4","基金持有信息表"),
    FUND_OPEN_INFO("5","基金产品开放日信息表"),
    INVESTOR_BANK_INFO("6","基金出资人银行账户信息表"),
    FUND_TRADE_APPLY_INFO("7","基金交易申请信息表"),
    FUND_TRADE_INFO("8","基金交易确认信息表"),
    FUND_TRADE_DETAIL_INFO("9","基金交易确认明细表"),
    FUND_PROFIT_INFO("10","业绩报酬信息表"),
    CUST_SHARE_DETAIL_INFO("11","基金持有份额明细表"),
    CUST_SHARE_SEQ_INFO("12","基金持有份额变化流水表"),
    FUND_BONUS_INFO("13","基金分红记录表"),
    FUND_TEMP_FARE_INFO("14","基金估值表费用信息表"),
    ACCOUNT_INFO("15","资金账户基本信息表"),
    TGACCOUNT_BALANCE_INFO("16", "托管户银行账户余额信息表"),
    TGACCOUNT_SEQ_INFO("17","托管户流水表"),
    MJACCOUNT_BALANCE_INFO("18","募集户银行账户余额信息表"),
    MJACCOUNT_SEQ_INFO("19","募集户流水表"),
    FUND_VALUE_TABLE_DATA_INFO("20","基金估值报表数据表"),
    FUND_FEE_DATA_INFO("21","基金费用数据表"),
    CHARGE_FEE_DETAIL_INFO("22","费用计提明细表"),
    PAY_FEE_DETAIL_INFO("23","费用支付明细表"),
    ;

    private String code;
    private String type;

    DaasDataTypeEnum(String code, String type) {
        this.code = code;
        this.type = type;
    }

    @JsonValue
    @JSONField
    public String getCode() {
        return code;
    }

    public String getType() {
        return type;
    }

    @JsonCreator
    @JSONCreator
    public static DaasDataTypeEnum fromCode(String code) {
        for (DaasDataTypeEnum value : DaasDataTypeEnum.values()) {
            if (StringUtils.equals(value.getCode(), code)) {
                return value;
            }

        }
        throw new IllegalArgumentException(code);
    }
}
