package com.gree.mall.manager.enums.contract;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.collect.Lists;
import com.gree.mall.manager.enums.base.BaseEnum;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum FieldTypeEnum implements BaseEnum {
    CUSTOM("CUSTOM", "自定义"),
    YYYYMMDD("YYYYMMDD","日期(-)"),
//    YYYYMMDDTIME("YYYYMMDDTIME","日期时间"),
    NEXT_YYYY("NEXT_YYYY","下一年"),
    YYYY("YYYY","年"),
    MM("MM","月"),
    DD("DD","日"),
    Y_WEBSIT_NAME("Y_WEBSIT_NAME", "乙方名称"),
    Y_WEBSIT_ID("Y_WEBSIT_ID", "乙方编号"),
    Y_EMAIL("Y_EMAIL", "乙方邮箱"),
    Y_ADDRESS("Y_ADDRESS", "乙方地址"),
    Y_TEL("Y_TEL", "乙方电话"),
    Y_FAX("Y_FAX", "乙方传真"),
    Y_ZIP_CODE("Y_ZIP_CODE", "乙方邮编"),
    Y_BANK_DEPOSIT("Y_BANK_DEPOSIT","乙方开户行"),
    Y_BANK_ACCOUNT("Y_BANK_ACCOUNT","乙方账号"),
    Y_LEGAL_NAME("Y_LEGAL_NAME","乙方负责人"),
    WEBSIT_NAME("WEBSIT_NAME", "甲方名称"),
    SHORT_NAME("SHORT_NAME", "甲方简称"),
    ADDRESS("ADDRESS", "甲方地址"),
    TEL("TEL", "甲方电话"),
    FAX("FAX", "甲方传真"),
    ZIP_CODE("ZIP_CODE", "甲方邮编"),
//    EMAIL("EMAIL", "甲方邮箱"),
    BANK_DEPOSIT("BANK_DEPOSIT","甲方开户行"),
    BANK_ACCOUNT("BANK_ACCOUNT","甲方账号"),
    CA_LEGAL_NAME("CA_LEGAL_NAME","甲方负责人"),
//    WEBSIT_ID("WEBSIT_ID", "甲方编号"),
    ;

    @JsonValue
    @EnumValue
    private final String key;
    private final String remark;

    /**
     * 网点模板字段
     * @return
     */
    public static Map<String, Object> websitList() {
        Map<String, Object> fieldMap = EnumUtil.getNameFieldMap(FieldTypeEnum.class, "remark");
        ArrayList<FieldTypeEnum> fieldTypeEnums = Lists.newArrayList(CUSTOM, YYYYMMDD, NEXT_YYYY, YYYY, MM,
                DD, Y_WEBSIT_NAME, Y_WEBSIT_ID, Y_EMAIL, Y_ADDRESS, Y_TEL, Y_FAX, Y_ZIP_CODE, Y_BANK_DEPOSIT,
                Y_BANK_ACCOUNT, Y_LEGAL_NAME, WEBSIT_NAME,
                SHORT_NAME, ADDRESS, TEL, FAX, ZIP_CODE, BANK_DEPOSIT, BANK_ACCOUNT, CA_LEGAL_NAME);
        Map<String, Object> map = new LinkedHashMap<>();
        for (FieldTypeEnum typeEnum : fieldTypeEnums) {
            map.put(typeEnum.getKey(), fieldMap.get(typeEnum.getKey()));
        }
        return map;
    }
}
