package com.simuwang.base.common.conts;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;


/**
 * @author mozuwen
 * @date 2024/03/19
 * @describe 会计科目
 */
public class AccountingNewItems {

    /**
     * 现金类
     */
    public final static HashSet<String> CASH = toHashSet("1002,1021,1031,3003");

    /**
     * 股票类
     */
    public final static HashSet<String> EQUITY_LIST = toHashSet("1102,2101");

    /**
     * 债券类
     */
    public final static HashSet<String> BOND_LIST = toHashSet("1103,1104");

    /**
     * 正逆回购: 1202-逆回购,2202-正回购
     */
    public final static HashSet<String> BOND_BACK_LIST = toHashSet("1202,2202");

    /**
     * 基金类
     */
    public final static List<String> FUND_LIST = toList("1105,1107,1108,1109,1110");

    /**
     * 期货及衍生品类
     */
    public final static List<String> DERIVATIVES = toList("3102,3201,3103,3101");

    /**
     * 权证
     */
    public final static String WARRANT = "1106";

    /**
     * 其他
     */
    public final static HashSet<String> OTHER = toHashSet("4,5");

    /**
     * 其他资产
     */
    public final static HashSet<String> OTHER_ASSET = toHashSet("1");

    /**
     * 其他
     */
    public final static HashSet<String> OTHER_DEBT = toHashSet("2");

    /**
     * 股指期货
     */
    public final static HashSet<String> INDEX_FUTRUE = toHashSet("IZ,IH,IF,IC,IM");

    /**
     * 国债期货
     */
    public final static HashSet<String> BOND_FUTRUE = toHashSet("TF,0T");

    /**
     * 商品期货
     */
    public final static HashSet<String> CMDT_FUTRUE = toHashSet("TC,SR,SM,SF,RS,RM,TA,FG,MA,V,FB,M,PP,Y,BB,JM,P,I,J,L,CU,AL,RU,ZN,RB,"
            + "WR,AG,AU,BU,HC,PB,IF,A,B,IM,RO,FU,TF,JD,PM,"
            + "OI,RI,WH,JR,CF,C,LR,TT-S,TM,EF-S,AF-S,WS,WT,CS,IFM,T,SN,NI,IC,IH,ZC,ER,TS-S,SC,CY,AP,TS,SP,FR007_3M,ShiborON_1M,"
            + "Shibor3M_3M,CDB10,Shibor1W_3M,CDB3,CDB5,EG,TL-S,CJ,UR,NR,RR,SS,EB,SA,SCTAS,ME");


    private static List<String> toList(String code) {
        if (null == code || "".equals(code.trim())) {
            return null;
        }
        return Arrays.asList(code.replaceAll("\\s+", "").split(","));
    }


    private static HashSet<String> toHashSet(String string) {
        String[] arr = string.replaceAll("\\s+", "").split(",");
        HashSet<String> set = new HashSet<>(arr.length);
        set.addAll(Arrays.asList(arr));
        return set;
    }
}
