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

import java.io.IOException;

/**
 * 手续费处理模式
 */

public enum FeeType {

    EARNING_EXPENSE, NETTING, OFFLINE;

    public String toValue() {
        return switch (this) {
            case EARNING_EXPENSE -> "EARNING_EXPENSE";
            case NETTING -> "NETTING";
            case OFFLINE -> "OFFLINE";
        };
    }

    public static FeeType forValue(String value) throws IOException {
        return switch (value) {
            case "EARNING_EXPENSE" -> EARNING_EXPENSE;
            case "NETTING" -> NETTING;
            case "OFFLINE" -> OFFLINE;
            default -> throw new IOException("Cannot deserialize FeeType");
        };
    }
}
