package com.ruoyi.bst.suit.domain;

import java.math.BigDecimal;
import java.util.List;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.ruoyi.bst.suit.domain.vo.SuitIntervalFeeRule;
import com.ruoyi.bst.suit.domain.vo.SuitStartFeeRule;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.constants.DictType;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.interfaces.LogBizParam;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.common.valid.DictValid;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 套餐对象 bst_suit
 *
 * @author ruoyi
 * @date 2025-03-17
 */
@Data
public class Suit extends BaseEntity implements LogBizParam
{
    private static final long serialVersionUID = 1L;

    private Long id;

    @Excel(name = "运营商id")
    @ApiModelProperty("运营商id")
    @NotNull(message = "运营商id不能为空", groups = {ValidGroup.Create.class})
    private Long userId;

    @Excel(name = "套餐类型")
    @ApiModelProperty("套餐类型")
    @NotBlank(message = "套餐类型不能为空", groups = {ValidGroup.Create.class})
    @DictValid(type = DictType.SUIT_TYPE)
    private String type;

    @Excel(name = "套餐名称")
    @ApiModelProperty("套餐名称")
    @NotBlank(message = "套餐名称不能为空", groups = {ValidGroup.Create.class})
    @Size(max = 32, message = "套餐名称不能超过32个字符")
    private String name;

    @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
    @ApiModelProperty("状态")
    @NotNull(message = "状态不能为空", groups = {ValidGroup.Create.class})
    private String status;

    @Excel(name = "免费骑行时长(分钟)")
    @ApiModelProperty("免费骑行时长(分钟)")
    @NotNull(message = "免费骑行时长不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "免费骑行时长不能小于0")
    private Integer freeRideTime;

    @Excel(name = "租赁单位", readConverterExp = "m=inutes分钟,h=ours小时,d=ay天")
    @ApiModelProperty("租赁单位")
    @NotBlank(message = "租赁单位不能为空", groups = {ValidGroup.Create.class})
    private String rentalUnit;

    @Excel(name = "计费方式", readConverterExp = "1=起步价计费,2=区间计费")
    @ApiModelProperty("计费方式")
    @NotNull(message = "计费方式不能为空", groups = {ValidGroup.Create.class})
    @DictValid(type = DictType.SUIT_RIDING_RULE)
    private String ridingRule;

    @Excel(name = "起步价计费规则")
    @ApiModelProperty("起步价计费规则")
    @Valid
    private SuitStartFeeRule startRule;

    @Excel(name = "区间计费规则")
    @ApiModelProperty("区间计费规则")
    @Valid
    private List<SuitIntervalFeeRule> intervalRule;

    @Excel(name = "骑行价格说明")
    @ApiModelProperty("骑行价格说明")
    @Size(max = 1000, message = "骑行价格说明不能超过1000个字符")
    private String instructions;

    @Excel(name = "显示顺序")
    @ApiModelProperty("显示顺序")
    @NotNull(message = "显示顺序不能为空", groups = {ValidGroup.Create.class})
    private Integer orderNum;

    @Excel(name = "预存款")
    @ApiModelProperty("预存款")
    @NotNull(message = "预存款不允许为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "预存款不能小于0")
    private BigDecimal depositAmount;

    @Excel(name = "可用时长（秒）")
    @ApiModelProperty("可用时长（秒）")
    private Long seconds;

    @Excel(name = "自动押金抵扣")
    @ApiModelProperty("自动押金抵扣")
    @NotNull(message = "自动押金抵扣不能为空", groups = {ValidGroup.Create.class})
    private Boolean depositDeduction;

    @Override
    public Object logBizId() {
        return id;
    }

}
