package com.yuchen.saas.payment.api.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * 钱包枚举
 */
@Data
public class WalletEnum {

    /**
     * 机构钱包类型枚举类
     */
    @Getter
    @AllArgsConstructor
    public enum WalletTypeEnum {

        PLATFORM_WALLET("1", "平台钱包"),
        CHANNEL_WALLET("2", "渠道钱包"),
        ;

        private final String code;
        private final String desc;

    }

    /**
     * 钱包类型枚举类
     */
    @Getter
    @AllArgsConstructor
    public enum WalletAccountTypeEnum {

        PERSON_WALLET("1", "个人钱包"),
        COMPANY_WALLET("2", "机构子钱包"),
        ;

        private final String code;
        private final String desc;

        public static String getEnumDesc(String code) {
            if (StrUtil.isNotBlank(code)) {
                for (WalletEnum.WalletAccountTypeEnum e : WalletEnum.WalletAccountTypeEnum.values()) {
                    if (e.getCode().equals(code)) {
                        return e.getDesc();
                    }
                }
            }
            return null;
        }
    }

    /**
     * 机构钱包账户类型枚举类
     */
    @Getter
    @AllArgsConstructor
    public enum OrgWalletAccountTypeEnum {

        BOSS_ORG_WALLET("1", "主机构钱包"),
        CHILD_ORG_WALLET("2", "子机构钱包"),
        ;

        private final String code;
        private final String desc;

    }

    /**
     * 机构钱包类型枚举类
     */
    @Getter
    @AllArgsConstructor
    public enum OrgChildWalletObjectTypeEnum {

        PLATFORM_USER("1", "平台用户"),
        ORG_TISSUE_USER("2", "机构组织成员"),
        ;

        private final String code;
        private final String desc;

    }

    @Getter
    @AllArgsConstructor
    public enum WalletStateTypeEnum {

        NORMAL_WALLET_STATE("1", "正常"),
        FREEZE_WALLET_STATE("2", "冻结"),
        ;

        private final String code;
        private final String desc;

        public static String getEnumDesc(String code) {
            if (StrUtil.isNotBlank(code)) {
                for (WalletEnum.WalletStateTypeEnum e : WalletEnum.WalletStateTypeEnum.values()) {
                    if (e.getCode().equals(code)) {
                        return e.getDesc();
                    }
                }
            }
            return null;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum WalletSubjectTypeEnum {

        PERSON("1", "个人"),
        COMPANY("2", "企业"),
        ;

        private final String code;
        private final String desc;

        public static String getEnumDesc(String code) {
            if (StrUtil.isNotBlank(code)) {
                for (WalletEnum.WalletSubjectTypeEnum e : WalletEnum.WalletSubjectTypeEnum.values()) {
                    if (e.getCode().equals(code)) {
                        return e.getDesc();
                    }
                }
            }
            return null;
        }

    }



}
