package cn.ysk.cashier.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author lyf
 */
@Getter
@AllArgsConstructor
public enum PayTypeEnum {
    CASH("cash","现金"),BANK("bank","银行卡"),SCANCODE("scanCode","扫码支付"),
    DEPOSIT("deposit","储值"),ARREARS("arrears","挂单"),WXLIST("wx_lite","微信小程序支付");

    private String type;

    private String name;



    public static String getNameByType(String name) {
        PayTypeEnum[] operateTypes = values();
        for (PayTypeEnum ot : operateTypes) {
            if (ot.name.equals(name)) {
                return ot.getType();
            }
        }
        return "未知支付方式";
    }

    public static String getCodeByName(String code) {
        PayTypeEnum[] operateTypes = values();
        for (PayTypeEnum ot : operateTypes) {
            if (ot.type.equals(code)) {
                return ot.getName();
            }
        }
        return "未知支付方式";
    }
}
