package com.czg.order.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.List;

/**
 * 挂账还款状态枚举
 *
 * @author tankaikai
 * @since 2025-03-04 17:53
 */
@Getter
@RequiredArgsConstructor
public enum CreditBuyerEnums {

    /**
     * 未还款
     */
    UNPAID("unpaid", "未还款"),

    /**
     * 部分还款
     */
    PARTIAL("partial", "部分还款"),
    /**
     * 已还清
     */
    PAID("paid", "已还清"),

    ;

    private final String value;
    private final String text;


    public static List<String> getValues() {
        return Arrays.stream(values()).map(CreditBuyerEnums::getValue).toList();
    }

    public static String getText(String value) {
        CreditBuyerEnums item = Arrays.stream(values()).filter(obj -> value.equals(obj.getValue())).findFirst().orElse(null);
        if (item != null) {
            return item.getText();
        }
        return null;
    }
}