package com.ruoyi.bst.order.domain.enums;

import java.util.List;

import com.ruoyi.common.utils.collection.CollectionUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OrderStatus {

    WAIT_PAY("WAIT_PAY", "押金待支付"),
    PROCESSING("PROCESSING", "进行中"),
    FINISHED("FINISHED", "已结束"),
    CANCELED("CANCELED", "已取消"),
    WAIT_VERIFY("WAIT_VERIFY", "待审核"),
    RIDE_WAIT_PAY("RIDE_WAIT_PAY", "骑行费待支付");

    private final String code;
    private final String name;


    // 允许支付的订单状态
    public static List<String> canPay() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 正在使用中的订单状态
    public static List<String> inUse() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING);
    }

    // 可以支付成功的订单状态
    public static List<String> canPaySuccess() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 可以结束的订单状态
    public static List<String> canEnd() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING);
    }

    // 可以退款的订单状态
    public static List<String> canRefund() {
        return CollectionUtils.map(OrderStatus::getCode, FINISHED);
    }

    // 未支付的订单状态
    public static List<String> unPayList() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 可以取消支付的订单状态
    public static List<String> canCancelPay() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_PAY);
    }

    // 可以审核的订单状态
    public static List<String> canVerify() {
        return CollectionUtils.map(OrderStatus::getCode, WAIT_VERIFY);
    }

    // 有效的订单状态：已支付的订单
    public static List<String> valid() {
        return CollectionUtils.map(OrderStatus::getCode, PROCESSING, FINISHED, WAIT_VERIFY, RIDE_WAIT_PAY);
    }

    // 已完成的订单
    public static List<String> finishedList() {
        return CollectionUtils.map(OrderStatus::getCode, FINISHED, WAIT_VERIFY, RIDE_WAIT_PAY);
    }

    // 允许押金抵扣的订单状态
    public static List<String> canDeduct() {
        return CollectionUtils.map(OrderStatus::getCode, RIDE_WAIT_PAY);
    }

    // 允许骑行支付成功的订单状态
    public static List<String> canRidePaySuccess() {
        return CollectionUtils.map(OrderStatus::getCode, RIDE_WAIT_PAY);
    }

    // 允许调起支付骑行费的订单状态
    public static List<String> canPayRideFee() {
        return CollectionUtils.map(OrderStatus::getCode, RIDE_WAIT_PAY);
    }

    // 允许改价的订单状态
    public static List<String> canUpdatePrice() {
        return CollectionUtils.map(OrderStatus::getCode, RIDE_WAIT_PAY);
    }

    // 允许恢复VIP优惠次数的订单状态
    public static List<String> canRecoverVipCount() {
        return CollectionUtils.map(OrderStatus::getCode, RIDE_WAIT_PAY);
    }
}
