package com.chushang.inspection.work.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * TODO 此处需要改下 对应的本级任务id
 */
@Getter
@AllArgsConstructor
public enum BankBranchesEnum {

    NANJING_BRANCH("4301", 82582240034336768L),
    SUZHOU_BRANCH("1102", 75464095280726016L),
    WUXI_BRANCH("1103", 1712316534449692673L),
    ZHENJIANG_BRANCH("1104", 130057876893859840L),
    CHANGZHOU_BRANCH("1105", 130058354490892288L),
    XUZHOU_BRANCH("1106", 130058663179059200L),
    LIANYUNGANG_BRANCH("1107", 104793956746788864L),
    YANGZHOU_BRANCH("1108", 130041300719325184L),
    YANCheng_BRANCH("1109", 130058775791927296L),
    HUAIAN_BRANCH("1110", 130058895585443840L),
    NANTONG_BRANCH("1111", 130058943010463744L),
    TAIZHOU_BRANCH("1115", 1706151311862829058L),
    SUQIAN_BRANCH("1116", 130059053442293760L);


    private final String code;
    private final long lowerTaskId;

    public static Long getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (BankBranchesEnum branch : BankBranchesEnum.values()) {
            if (branch.code.equals(code)) {
                return branch.lowerTaskId;
            }
        }
        return null;
    }

    public static String getByLowerTaskId(Long lowerTaskId) {
        for (BankBranchesEnum branch : BankBranchesEnum.values()) {
            if (branch.lowerTaskId == lowerTaskId) {
                return branch.code;
            }
        }
        return null;
    }
}
