package com.xinelu.manage.domain.receiveAddressInfo;

import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 收货人地址信息对象 receive_address_info
 *
 * @author xinyilu
 * @date 2022-10-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "收货人地址信息对象", description = "receive_address_info")
public class ReceiveAddressInfo extends BaseDomain implements Serializable {
    private static final long serialVersionUID = -3006189332927896126L;
    /**
     * 主键id
     */
    private Long id;

    /**
     * 会员id
     */
    @ApiModelProperty(value = "会员id")
    @Excel(name = "会员id")
    @NotNull(message = "会员id为空", groups = {Insert.class, Update.class})
    private Long patientId;

    /**
     * 微信openid
     */
    @ApiModelProperty(value = "微信openid")
    @Excel(name = "微信openid")
    private String openid;

    /**
     * 微信unionid
     */
    @ApiModelProperty(value = "微信unionid")
    @Excel(name = "微信unionid")
    private String unionid;

    /**
     * 收货人名称
     */
    @ApiModelProperty(value = "收货人名称")
    @Excel(name = "收货人名称")
    @NotBlank(message = "收货人名称为空", groups = {Insert.class, Update.class})
    @Length(max = 30, message = "收货人名称不能超过30位", groups = {Insert.class, Update.class})
    private String receiveName;

    /**
     * 联系电话
     */
    @ApiModelProperty(value = "联系电话")
    @Excel(name = "联系电话")
    @NotBlank(message = "联系电话不能为空", groups = {Insert.class, Update.class})
    @Length(max = 11, message = "联系电话不能超过11位", groups = {Insert.class, Update.class})
    private String receivePhone;

    /**
     * 收货人地址
     */
    @ApiModelProperty(value = "收货人地址")
    @Excel(name = "收货人地址")
    @NotBlank(message = "收货人地址不能为空", groups = {Insert.class, Update.class})
    @Length(max = 50, message = "收货人地址不能超过50位", groups = {Insert.class, Update.class})
    private String receiveAddress;

    /**
     * 区域编码
     */
    @ApiModelProperty(value = "区域编码")
    @Excel(name = "区域编码")
    @NotBlank(message = "请选择地址信息！", groups = {Insert.class, Update.class})
    @Length(max = 20, message = "区域编码不能超过20位", groups = {Insert.class, Update.class})
    private String areaCode;

    /**
     * 默认地址标识，0：否，1：是
     */
    private Integer defaultAddressFlag;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("patientId", getPatientId())
                .append("openid", getOpenid())
                .append("unionid", getUnionid())
                .append("receiveName", getReceiveName())
                .append("receivePhone", getReceivePhone())
                .append("receiveAddress", getReceiveAddress())
                .append("areaCode", getAreaCode())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
