package com.webchat.common.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author 程序员七七
 * @webSite https://www.coderutil.com
 * @Date 2022/11/17 00:14
 * @description
 */
public class LotteryConstants {

    /**
     * 抽奖活动ID前缀 LotteryActivity: LA
     */
    public static final String LOTTERY_ACTIVITY_ID_PREFIX = "LA";
    /**
     * 抽奖订单活动ID前缀 LotteryOrder: LO
     */
    public static final String LOTTERY_ORDER_ID_PREFIX = "LO";
    /**
     * 活动奖品数量应该为8个
     */
    public static final int LOTTERY_ITEM_COUNT = 8;
    /**
     * 系统
     */
    public static final String SYSTEM = "SYSTEM";

    /**
     * 抽奖活动状态枚举
     */
    @Getter
    @AllArgsConstructor
    public enum LotteryActivityStatus {

        PREPARATION(1, "筹备中"),
        RUNNING(2, "进行中"),
        CLOSED(3, "已结束"),
        DELETED(4, "已删除");

        private Integer status;
        private String statusName;
    }

    /**
     * 抽奖活动状态枚举
     */
    @Getter
    @AllArgsConstructor
    public enum LotteryOrderStatus {

        UNCHANGED(1, "未兑换"),
        EXCHANGED(2, "已兑换"),
        DELETED(3, "已删除");

        private Integer status;
        private String statusName;
    }

    /**
     * 抽奖奖品类型
     */
    @Getter
    @AllArgsConstructor
    public enum LotteryItemType {

        INTEGRAL(1, "猿气值"),
        GOODS(2, "实体商品"),
        MONEY(3, "现金红包");

        private Integer type;
        private String typeName;
    }

    /**
     * 根据活动状态获取活动中文名称
     *
     * @param status
     * @return
     */
    public static String getLotteryActivityStatusName(Integer status) {
        if (status == null) {
            return "";
        }
        for (LotteryActivityStatus lotteryActivityStatus : LotteryActivityStatus.values()) {
            if (lotteryActivityStatus.status.equals(status)) {
                return lotteryActivityStatus.statusName;
            }
        }
        return "";
    }

    /**
     * 根据活动状态获取活动中文名称
     *
     * @param type
     * @return
     */
    public static String getLotteryActivityItemTypeName(Integer type) {
        if (type == null) {
            return "";
        }
        for (LotteryItemType lotteryItemType : LotteryItemType.values()) {
            if (lotteryItemType.type.equals(type)) {
                return lotteryItemType.typeName;
            }
        }
        return "";
    }

    /**
     * 根据订单状态获取中文描述
     *
     * @param status
     * @return
     */
    public static String getLotteryOrderStatusName(Integer status) {
        if (status == null) {
            return "";
        }
        for (LotteryOrderStatus lotteryOrderStatus : LotteryOrderStatus.values()) {
            if (lotteryOrderStatus.status.equals(status)) {
                return lotteryOrderStatus.statusName;
            }
        }
        return "";
    }
}
