package com.haha.common.enums;

public enum DepositStatus {

    UNPAID("UNPAID", "未缴纳"),
    PARTIAL("PARTIAL", "部分缴纳"),
    FULL("FULL", "全额缴纳");

    private final String code;
    private final String description;

    DepositStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static DepositStatus fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (DepositStatus depositStatus : values()) {
            if (depositStatus.code.equals(code)) {
                return depositStatus;
            }
        }
        return null;
    }

    public static String getDescription(String code) {
        DepositStatus depositStatus = fromCode(code);
        return depositStatus != null ? depositStatus.description : "未知";
    }
}
