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

import java.io.IOException;

/**
 * 二维码类型，payType=UnionPayJsapi、UnionPayJsMini时必填。
 */
public enum QrCodeType {

    EMPTY, THE_0, THE_1;

    public String toValue() {
        switch (this) {
            case EMPTY -> {
                return "其他";
            }
            case THE_0 -> {
                return "0";
            }
            case THE_1 -> {
                return "1";
            }
        }
        return null;
    }

    public static QrCodeType forValue(String value) throws IOException {
        return switch (value) {
            case "其他" -> EMPTY;
            case "0" -> THE_0;
            case "1" -> THE_1;
            default -> throw new IOException("Cannot deserialize QrCodeType");
        };
    }
}
