package com.wzj.soopin.transaction.enums.easypay;

import java.io.IOException;

/**
 * 卡类型
 */
public enum CardType {

    THE_000_C, THE_000_D, THE_000_U, XXXX;

    public String toValue() {
        return switch (this) {
            case THE_000_C -> "000C";
            case THE_000_D -> "000D";
            case THE_000_U -> "000U";
            case XXXX -> "XXXX";
        };
    }

    public static CardType forValue(String value) throws IOException {
        return switch (value) {
            case "000C" -> THE_000_C;
            case "000D" -> THE_000_D;
            case "000U" -> THE_000_U;
            case "XXXX" -> XXXX;
            default -> throw new IOException("Cannot deserialize CardType");
        };
    }
}
