package com.snack.server.module.address.dto.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;

/**
 * 新增/更新地址请求
 */
@Data
@Schema(description = "收货地址请求")
public class AddressSaveReq implements Serializable {

    @Schema(description = "地址 ID（更新时必填）")
    private Long id;

    @NotBlank(message = "收货人姓名不能为空")
    @Size(max = 50, message = "姓名最长 50 字")
    @Schema(description = "收货人姓名", example = "张三")
    private String receiver;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    @Schema(description = "手机号", example = "13800138000")
    private String phone;

    @Schema(description = "省", example = "广东省")
    private String province;

    @Schema(description = "市", example = "深圳市")
    private String city;

    @Schema(description = "区/县", example = "南山区")
    private String district;

    @NotBlank(message = "详细地址不能为空")
    @Size(max = 255, message = "详细地址最长 255 字")
    @Schema(description = "详细地址", example = "科技园南路 88 号")
    private String detail;

    @Size(max = 20, message = "标签最长 20 字")
    @Schema(description = "标签：家/公司/学校")
    private String tag;

    @Schema(description = "是否设为默认：0-否 1-是", example = "0")
    private Integer isDefault = 0;
}
