package com.izouma.dingdong.domain.user;

import com.izouma.dingdong.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import java.io.Serializable;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Builder
//@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
@ApiModel(value = "Address", description = "收获地址记录")
public class Address extends BaseEntity implements Serializable {
    @ApiModelProperty("用户Id")
    private Long userId;

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

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

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

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

    @Column(nullable = false)
    private Boolean enabled = true;

    public String getAddressInfo() {
        return name + "," + phone + "," + addressName;
    }
}
