package com.izouma.immall.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Builder
@ApiModel(value = "收货地址记录", description = "收获地址记录")
public class UserAddress extends BaseEntity implements Serializable {
    @ApiModelProperty("用户Id")
    private Long userId;

    private String openId;

    @ApiModelProperty("收件人姓名")
    private String name;

    @ApiModelProperty("收件人电话")
    private String phone;

    @ApiModelProperty("收件人省")
    private String province;

    @ApiModelProperty("收件人市")
    private String citry;

    @ApiModelProperty("收件人区")
    private String district;

    @ApiModelProperty("详细地址")
    private String address;

    @ApiModelProperty("是否选为默认地址")
    private boolean isDefault;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "userId", insertable = false, updatable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    private User user;

}
