using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Atomx.Common.Entities
{
    /// <summary>
    /// 用户收货地址信息
    /// </summary>
    [Table("Addresses")]
    public class Address
    {
        /// <summary>
        /// 数据ID
        /// </summary>
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 添加地址用户
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// 收件人姓名
        /// </summary>
        [Column(TypeName = "varchar(128)")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 邮件地址
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Email { get; set; } = string.Empty;

        /// <summary>
        /// 电话号码
        /// </summary>
        [Column(TypeName = "varchar(20)")]
        public string Phone { get; set; } = string.Empty;

        /// <summary>
        /// 公司
        /// </summary>
        [Column(TypeName = "varchar(255)")]
        public string Company { get; set; } = string.Empty;

        /// <summary>
        /// 国家ID
        /// </summary>
        public long CountryId { get; set; }

        /// <summary>
        /// 国家
        /// </summary>
        [Column(TypeName = "varchar(50)")]
        public string Country { get; set; } = string.Empty;

        /// <summary>
        /// 省份
        /// </summary>
        public long ProvinceId { get; set; }

        /// <summary>
        /// 省、州
        /// </summary>
        [Column(TypeName = "varchar(100)")]
        public string Province { get; set; } = string.Empty;

        /// <summary>
        /// 城市
        /// </summary>
        public long CityId { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        [Column(TypeName = "varchar(100)")]
        public string City { get; set; } = string.Empty;

        /// <summary>
        /// 地区
        /// </summary>
        public long RegionId { get; set; }

        /// <summary>
        /// 地区街
        /// </summary>
        [Column(TypeName = "varchar(100)")]
        public string Region { get; set; } = string.Empty;

        /// <summary>
        /// 邮政编码
        /// </summary>
        [Column(TypeName = "varchar(15)")]
        public string PostalCode { get; set; } = string.Empty;

        /// <summary>
        /// 详细地址
        /// </summary>
        [Column(TypeName = "varchar(256)")]
        public string AddressDetails { get; set; } = string.Empty;

        /// <summary>
        /// 完整地址
        /// </summary>
        [Column(TypeName = "varchar(1024)")]
        public string FullAddress { get; set; } = string.Empty;

        /// <summary>
        /// 地址所在经度
        /// </summary>
        [Column(TypeName = "decimal(10,6)")]
        public decimal Longitude { get; set; }

        /// <summary>
        /// 地址所在纬度
        /// </summary>
        [Column(TypeName = "decimal(10,6)")]
        public decimal Latitude { get; set; }

        /// <summary>
        /// 是否是虚拟地址
        /// </summary>
        public bool IsVirtual { get; set; }

        /// <summary>
        /// 地址使用次数
        /// </summary>
        public int Count { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsDelete { get; set; }

        /// <summary>
        /// 建立时间
        /// </summary>
        [Column(TypeName = "timestamptz")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        [Column(TypeName = "timestamptz")]
        public DateTime? UpdateTime { get; set; }
    }
}