package com.fs.his.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

@Getter
@AllArgsConstructor
public enum FsStoreOrderLogEnum {
    REFUND_ORDER_SUCCESS("refund_price_success","退款成功"),
    ORDER_EDIT("order_edit","订单改价"),
    REMOVE_ORDER("remove_order","删除订单"),
    EVAL_ORDER("order_eval","用户评价"),
    REFUND_ORDER_APPLY("apply_refund","用户申请退款"),
    TAKE_ORDER_DELIVERY("user_take_delivery","用户已收货"),
    PAY_ORDER_SUCCESS("pay_success","用户付款成功"),
    PAY_REMAIN_ORDER_SUCCESS("pay_remain_success","用户付款尾款成功"),

    CREATE_ORDER("create_order","订单生成"),
    CANCEL_ORDER("cancel_order","订单已取消"),
    NONE_ORDER("NONE","订单OK"),
    DELIVERY_GOODS("delivery_goods", "订单发货"),
    FINISH_ORDER("finish","确认收货"),
    LOCK_TUI_MONEY("lock_tui_money","冻结推广金"),
    UNLOCK_TUI_MONEY("unlock_tui_money","解冻推广金"),
    EDIT_ORDER_PRICE("edit_order_money","改价");

    private String value;
    private String desc;



    public static FsStoreOrderLogEnum toType(String value) {
        return Stream.of(FsStoreOrderLogEnum.values())
                .filter(p -> p.value.equals(value))
                .findAny()
                .orElse(null);
    }

    public static String getDesc(String value) {
        return toType(value) == null ? null : toType(value).desc;
    }
}
