package com.ruoyi.bst.area.domain;

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

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

import org.springframework.format.annotation.DateTimeFormat;

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_area
 *
 * @author ruoyi
 * @date 2025-03-14
 */
@Data
public class Area extends BaseEntity implements LogBizParam
{
    private static final long serialVersionUID = 1L;

    private Long id;

    @Excel(name = "所属运营商ID")
    @ApiModelProperty("所属运营商ID")
    private Long userId;

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

    @Excel(name = "边界值")
    @ApiModelProperty("边界值")
    private String boundary;

    @Excel(name = "边界值(高德地图)")
    @ApiModelProperty("边界值(高德地图)")
    private String boundaryStr;

    @Excel(name = "经度")
    @ApiModelProperty("经度")
    private BigDecimal longitude;

    @Excel(name = "纬度")
    @ApiModelProperty("纬度")
    private BigDecimal latitude;

    @Excel(name = "联系人")
    @ApiModelProperty("联系人")
    private String contact;

    @Excel(name = "联系联系方式")
    @ApiModelProperty("联系联系方式")
    private String phone;

    @Excel(name = "运营区状态：0-运营中；1-停运")
    @ApiModelProperty("运营区状态：0-运营中；1-停运")
    @NotBlank(message = "运营区状态不能为空", groups = {ValidGroup.Create.class})
    @DictValid(type = DictType.AREA_STATUS)
    private String status;

    @Excel(name = "运营区域外断电：0-关闭；1-开启")
    @ApiModelProperty("运营区域外断电：0-关闭；1-开启")
    private Boolean areaOutOutage;

    @Excel(name = "停车点外还车调度:0-关闭；1-开启")
    @ApiModelProperty("停车点外还车调度:0-关闭；1-开启")
    private Boolean parkingOutDispatch;

    @Excel(name = "电子围栏外还车调度:0-关闭；1-开启")
    @ApiModelProperty("电子围栏外还车调度:0-关闭；1-开启")
    private Boolean areaOutDispatch;

    @Excel(name = "禁行区内断电:0-关闭；1-开启")
    @ApiModelProperty("禁行区内断电:0-关闭；1-开启")
    private Boolean noRidingOutage;

    @Excel(name = "认证类型")
    @ApiModelProperty("认证类型")
    private List<String> authentication;

    @Excel(name = "短信通知服务:0-关闭；1-开启")
    @ApiModelProperty("短信通知服务:0-关闭；1-开启")
    private Boolean msgSwitch;

    @Excel(name = "最低解锁电量", readConverterExp = "%=")
    @ApiModelProperty("最低解锁电量")
    @NotNull(message = "最低解锁电量不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "最低解锁电量不能小于0")
    private Integer undercharge;

    @Excel(name = "还车误差", readConverterExp = "米=")
    @ApiModelProperty("还车误差")
    @NotNull(message = "还车误差不能为空", groups = {ValidGroup.Create.class})
    @Min(value = 0, message = "还车误差不能小于0")
    private BigDecimal error;

    @Excel(name = "安全协议")
    @ApiModelProperty("安全协议")
    private String agreement;

    @Excel(name = "默认押金(元)")
    @ApiModelProperty("默认押金(元)")
    private BigDecimal deposit;

    @Excel(name = "停车点外调度费")
    @ApiModelProperty("停车点外调度费")
    @Min(value = 0, message = "停车点外调度费不能小于0")
    private BigDecimal dispatchFee;

    @Excel(name = "运营区外调度费")
    @ApiModelProperty("运营区外调度费")
    @Min(value = 0, message = "运营区外调度费不能小于0")
    private BigDecimal vehicleManagementFee;

    @Excel(name = "运营开始时间")
    @ApiModelProperty("运营开始时间")
    @DateTimeFormat(pattern = "HH:mm:ss")
    private LocalTime areaTimeStart;

    @Excel(name = "运营结束时间")
    @ApiModelProperty("运营结束时间")
    @DateTimeFormat(pattern = "HH:mm:ss")
    private LocalTime areaTimeEnd;

    @Excel(name = "必须停车点还车")
    @ApiModelProperty("必须停车点还车")
    private Boolean parkingReturn;

    @Excel(name = "允许运营区外还车")
    @ApiModelProperty("允许运营区外还车")
    private Boolean areaOutReturn;

    @Excel(name = "还车是否审核")
    @ApiModelProperty("还车是否审核")
    private Boolean returnVerify;

    @Excel(name = "导览左上角坐标")
    @ApiModelProperty("导览左上角坐标")
    private String upperLeft;

    @Excel(name = "导览右下角坐标")
    @ApiModelProperty("导览右下角坐标")
    private String lowerRight;

    @Excel(name = "导览图片")
    @ApiModelProperty("导览图片")
    private String guideMap;

    @Excel(name = "导览开关")
    @ApiModelProperty("导览开关")
    private Boolean guideSwitch;

    @Excel(name = "创建人ID")
    @ApiModelProperty("创建人ID")
    private Long createId;

    @Excel(name = "靠近边界播报距离")
    @ApiModelProperty("靠近边界播报距离(米)")
    @Min(value = 0, message = "靠近边界播报距离不能小于0")
    private BigDecimal boundaryDistance;

    @Excel(name = "运营区外断电距离") 
    @ApiModelProperty("运营区外断电距离(米)")
    @Min(value = 0, message = "运营区外断电距离不能小于0")
    private BigDecimal outageDistance;

    @Excel(name = "用户响铃寻车范围")
    @ApiModelProperty("用户响铃寻车范围(米)")
    @Min(value = 0, message = "用户响铃寻车范围不能小于0")
    private BigDecimal ringRadius;

    @Excel(name = "响铃寻车是否必须在范围内")
    @ApiModelProperty("响铃寻车是否必须在范围内")
    private Boolean requiredRingRadius;

    @Excel(name = "超时是否自动断电")
    @ApiModelProperty("超时是否自动断电")
    private Boolean timeoutLock;

    @Excel(name = "骑行前是否需要绕车检查视频")
    @ApiModelProperty("骑行前是否需要绕车检查视频")
    private Boolean needCheckVideo;

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