package com.pig4cloud.pig.marketing.api.dto.common;


import com.pig4cloud.pig.marketing.api.valid.ValueRange;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author: lwh
 * @date: 2025-07-29
 * @description: IP相关DTO的公共父类
 */
@Data
public class BaseIpDTO implements Serializable {
	@Serial
	private static final long serialVersionUID = 1L;

	@NotNull(message = "ipType不能为空")
	@ValueRange(values = {1, 2}, message = "IP类型值不合法（1-白名单，2-黑名单）")
	@Schema(description = "ip类型,1-白名单,2-黑名单")
	private Integer ipType;

	@NotNull(message = "sourceType不能为空")
	@Schema(description = "来源类型值不合法（1-来自分组，2-具体IP）")
	@ValueRange(values = {1, 2}, message = "来源类型只能是1或2")
	private Integer sourceType;

	@Schema(description = "分组ID")
	private Long groupId;

	@Schema(description = "分组名称")
	@Size(max = 255, message = "分组名称长度不能超过255")
	private String groupName;

	@Schema(description = "ip模式,1-单IP,2-IP段")
	@ValueRange(values = {1, 2}, message = "IP模式值不合法（1-单IP，2-IP段）")
	private Integer ipMode;

	@Schema(description = "起始IP")
	private String startIp;

	@Schema(description = "结束IP")
	private String endIp;
}
