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

import java.io.IOException;

/**
 * 分账标识，与主单分账标识互斥，不能同时上送1
 * 0 非分账交易
 * 1 交易后分账 支付成功后调5.1请求分账接口发起分账
 * 2 交易中分账 必须交易中同步上送分账信息，且一次分完
 *
 * 分账标识
 */
public enum SplitSettleFlag {

    THE_0, THE_1, THE_2;

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

    public static SplitSettleFlag forValue(String value) throws IOException {
        return switch (value) {
            case "0" -> THE_0;
            case "1" -> THE_1;
            case "2" -> THE_2;
            default -> throw new IOException("Cannot deserialize SplitSettleFlag");
        };
    }
}
