package com.sf.service.gateway.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.sf.common.annotation.Excel;
import com.sf.common.core.domain.BaseEntity;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;

/**
 * 策略管理对象 Gateway_strategy
 * 
 * @author zoukun
 * @date 2024-04-22
 */
@Data
public class GatewayStrategy extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    private Long id;

    /** 策略名称 */
    @Excel(name = "策略名称")
    @NotBlank(message = "策略名称不能为空")
    private String strategyName;

    /** 策略类型（AUTHENTICATION=认证策略，PERMISSION=鉴权策略，CURRENT_LIMITING=限流策略，CIRCUIT_BREAKER=熔断策略） */
    @Excel(name = "策略类型")
    @NotBlank(message = "策略类型不能为空")
    private String strategyType;

    /** 策略描述 */
    @Excel(name = "策略描述")
    private String description;

    /** 请求方式 */
    @Excel(name = "请求方式")
    private String requestMethod;

    /** 策略状态（0停用 1启用） */
    @Excel(name = "策略状态", readConverterExp = "0=停用,1=启用")
    private String status;

    @ApiModelProperty("应用编号")
    private String appCode;

    @ApiModelProperty("创建者")
    private String created;

    @ApiModelProperty("更新者")
    private String modified;

    @ApiModelProperty("接口限流阈值")
    @DecimalMin(value = "0",message = "接口限流阈值大于等于0" )
    private Integer currentLimitingThreshold;

    @ApiModelProperty("接口限流时间窗口，单位s")
    @DecimalMin(value = "0",message = "接口限流时间窗口大于等于0" )
    private Integer currentLimitingTimeWindow;

    @ApiModelProperty("接口限流响应，JSON字符串")
    private String currentLimitingResponse;

    @ApiModelProperty("熔断阈值（调用失败阈值）")
    @DecimalMin(value = "0",message = "熔断阈值大于等于0" )
    private Integer circuitBreakerThreshold;

    @ApiModelProperty("调用失败阈值对应的时间窗口，单位s")
    @DecimalMin(value = "0",message = "调用失败阈值对应的时间窗口大于等于0" )
    private Integer circuitBreakerTimeWindow;

    @ApiModelProperty("熔断后的恢复时间间隔，单位s")
    @DecimalMin(value = "0",message = "熔断后的恢复时间间隔大于等于0" )
    private Integer circuitBreakerRecoveryInterval;

    @ApiModelProperty("熔断响应，JSON字符串")
    private String circuitBreakerResponse;

}
