package com.ruoyi.ss.suit.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author wjh
 * 2024/8/13
 */
@Getter
@AllArgsConstructor
public enum SuitFeeType {

    TIME("1", "计时收费"),
    COUNT("2", "按量收费"),
    TIMING_COUNT("3", "分时段按量收费"),
    TIMING_TIME("4", "分时段按时收费");

    private final String type;
    private final String msg;

    public static List<String> asList(SuitFeeType ...types) {
        return Arrays.stream(types).map(SuitFeeType::getType).collect(Collectors.toList());
    }

    /**
     * 允许单次收费的类型
     */
    public static List<String> allowSingle() {
        return asList(TIME, COUNT);
    }

    /**
     * 需要设置分时的类型
     */
    public static List<String> timingList() {
        return asList(TIMING_COUNT, TIMING_TIME);
    }

    /**
     * 需要配置单次购买时长/度的类型
     */
    public static List<String> singleList() {
        return asList(TIME, COUNT);
    }

    /**
     * 需要配置时长单位的类型
     */
    public static List<String> needConfigTimeUnit() {
        return asList(TIME);
    }

    /**
     * 充值时长的类型
     */
    public static List<String> rechargeTimeList() {
        return asList(TIME, TIMING_TIME);
    }

    /**
     * 充值电量的类型
     */
    public static List<String> rechargeCountList() {
        return asList(COUNT, TIMING_COUNT);
    }
}
