package org.dromara.mall.trade.domain.vo;

import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.mall.trade.domain.MallAddress;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

/**
 * 收货地址视图对象 mall_address
 *
 * @author pengles
 */
@Data
@AutoMapper(target = MallAddress.class)
public class MallAddressVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 地址ID
     */
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 收货人姓名
     */
    private String receiverName;

    /**
     * 收货人电话
     */
    private String receiverPhone;

    /**
     * 省份
     */
    private String province;

    /**
     * 城市
     */
    private String city;

    /**
     * 区/县
     */
    private String district;

    /**
     * 详细地址
     */
    private String address;

    /**
     * 是否默认地址(0否 1是)
     */
    private Integer isDefault;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 完整地址（省份+城市+区/县+详细地址）
     */
    public String getFullAddress() {
        StringBuilder fullAddress = new StringBuilder();
        if (province != null && !province.isEmpty()) {
            fullAddress.append(province);
        }
        if (city != null && !city.isEmpty()) {
            fullAddress.append(city);
        }
        if (district != null && !district.isEmpty()) {
            fullAddress.append(district);
        }
        if (address != null && !address.isEmpty()) {
            fullAddress.append(address);
        }
        return fullAddress.toString();
    }

}
