using System.Text.Json.Serialization;

namespace HoneyBox.Model.Models.Address;

/// <summary>
/// 地址响应DTO（兼容PHP API格式）
/// </summary>
public class AddressDto
{
    /// <summary>
    /// 地址ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [JsonPropertyName("user_id")]
    public int UserId { get; set; }

    /// <summary>
    /// 收货人姓名
    /// </summary>
    [JsonPropertyName("receiver_name")]
    public string ReceiverName { get; set; } = string.Empty;

    /// <summary>
    /// 收货人电话
    /// </summary>
    [JsonPropertyName("receiver_phone")]
    public string ReceiverPhone { get; set; } = string.Empty;

    /// <summary>
    /// 详细地址
    /// </summary>
    [JsonPropertyName("detailed_address")]
    public string DetailedAddress { get; set; } = string.Empty;

    /// <summary>
    /// 是否默认地址: 0否 1是
    /// </summary>
    [JsonPropertyName("is_default")]
    public int IsDefault { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [JsonPropertyName("create_time")]
    public string? CreateTime { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [JsonPropertyName("update_time")]
    public string? UpdateTime { get; set; }
}

/// <summary>
/// 添加地址请求
/// </summary>
public class AddAddressRequest
{
    /// <summary>
    /// 收货人姓名
    /// </summary>
    [JsonPropertyName("receiver_name")]
    public string ReceiverName { get; set; } = string.Empty;

    /// <summary>
    /// 收货人电话
    /// </summary>
    [JsonPropertyName("receiver_phone")]
    public string ReceiverPhone { get; set; } = string.Empty;

    /// <summary>
    /// 详细地址
    /// </summary>
    [JsonPropertyName("detailed_address")]
    public string DetailedAddress { get; set; } = string.Empty;

    /// <summary>
    /// 是否设为默认地址: 0否 1是
    /// </summary>
    [JsonPropertyName("is_default")]
    public int IsDefault { get; set; }
}

/// <summary>
/// 更新地址请求
/// </summary>
public class UpdateAddressRequest
{
    /// <summary>
    /// 地址ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }

    /// <summary>
    /// 收货人姓名
    /// </summary>
    [JsonPropertyName("receiver_name")]
    public string ReceiverName { get; set; } = string.Empty;

    /// <summary>
    /// 收货人电话
    /// </summary>
    [JsonPropertyName("receiver_phone")]
    public string ReceiverPhone { get; set; } = string.Empty;

    /// <summary>
    /// 详细地址
    /// </summary>
    [JsonPropertyName("detailed_address")]
    public string DetailedAddress { get; set; } = string.Empty;

    /// <summary>
    /// 是否设为默认地址: 0否 1是
    /// </summary>
    [JsonPropertyName("is_default")]
    public int? IsDefault { get; set; }
}

/// <summary>
/// 地址ID请求
/// </summary>
public class AddressIdRequest
{
    /// <summary>
    /// 地址ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }
}
