using System.Text.Json.Serialization;

namespace HoneyBox.Model.Models.Config;

/// <summary>
/// 系统配置响应DTO
/// </summary>
public class ConfigResponseDto
{
    /// <summary>
    /// 商品类型列表
    /// </summary>
    [JsonPropertyName("good_type")]
    public List<GoodsTypeDto> GoodType { get; set; } = new();

    /// <summary>
    /// 应用设置
    /// </summary>
    [JsonPropertyName("app_setting")]
    public AppSettingDto? AppSetting { get; set; }

    /// <summary>
    /// 基础配置
    /// </summary>
    [JsonPropertyName("base_config")]
    public BaseConfigDto? BaseConfig { get; set; }

    /// <summary>
    /// 版本号
    /// </summary>
    [JsonPropertyName("version")]
    public string Version { get; set; } = "116";
}

/// <summary>
/// 商品类型DTO
/// </summary>
public class GoodsTypeDto
{
    /// <summary>
    /// 类型值
    /// </summary>
    [JsonPropertyName("value")]
    public int Value { get; set; }

    /// <summary>
    /// 排序值
    /// </summary>
    [JsonPropertyName("sort_order")]
    public int SortOrder { get; set; }

    /// <summary>
    /// 是否显示
    /// </summary>
    [JsonPropertyName("is_show")]
    public int IsShow { get; set; }

    /// <summary>
    /// 类型名称
    /// </summary>
    [JsonPropertyName("name")]
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 是否支持微信支付
    /// </summary>
    [JsonPropertyName("pay_wechat")]
    public int PayWechat { get; set; }

    /// <summary>
    /// 是否支持余额支付
    /// </summary>
    [JsonPropertyName("pay_balance")]
    public int PayBalance { get; set; }

    /// <summary>
    /// 是否支持积分支付
    /// </summary>
    [JsonPropertyName("pay_currency")]
    public int PayCurrency { get; set; }

    /// <summary>
    /// 是否支持积分2支付
    /// </summary>
    [JsonPropertyName("pay_currency2")]
    public int PayCurrency2 { get; set; }

    /// <summary>
    /// 是否支持优惠券
    /// </summary>
    [JsonPropertyName("pay_coupon")]
    public int PayCoupon { get; set; }

    /// <summary>
    /// 是否支持抵扣
    /// </summary>
    [JsonPropertyName("is_deduction")]
    public int IsDeduction { get; set; }
}

/// <summary>
/// 应用设置DTO
/// </summary>
public class AppSettingDto
{
    /// <summary>
    /// 应用名称
    /// </summary>
    [JsonPropertyName("app_name")]
    public string? AppName { get; set; }

    /// <summary>
    /// 应用Logo
    /// </summary>
    [JsonPropertyName("app_logo")]
    public string? AppLogo { get; set; }

    /// <summary>
    /// 客服电话
    /// </summary>
    [JsonPropertyName("service_phone")]
    public string? ServicePhone { get; set; }

    /// <summary>
    /// 客服微信
    /// </summary>
    [JsonPropertyName("service_wechat")]
    public string? ServiceWechat { get; set; }

    /// <summary>
    /// 其他动态属性
    /// </summary>
    [JsonExtensionData]
    public Dictionary<string, object>? ExtensionData { get; set; }
}

/// <summary>
/// 基础配置DTO
/// </summary>
public class BaseConfigDto
{
    /// <summary>
    /// 是否显示首弹
    /// </summary>
    [JsonPropertyName("is_shou_tan")]
    public int IsShouTan { get; set; }

    /// <summary>
    /// 跳转AppId
    /// </summary>
    [JsonPropertyName("jump_appid")]
    public string? JumpAppid { get; set; }

    /// <summary>
    /// 企业微信CorpId
    /// </summary>
    [JsonPropertyName("corpid")]
    public string? Corpid { get; set; }

    /// <summary>
    /// 微信链接
    /// </summary>
    [JsonPropertyName("wx_link")]
    public string? WxLink { get; set; }

    /// <summary>
    /// 福利群二维码图片
    /// </summary>
    [JsonPropertyName("erweima")]
    public string? Erweima { get; set; }

    /// <summary>
    /// 分享图片
    /// </summary>
    [JsonPropertyName("share_image")]
    public string? ShareImage { get; set; }

    /// <summary>
    /// 分享标题
    /// </summary>
    [JsonPropertyName("share_title")]
    public string? ShareTitle { get; set; }
}

/// <summary>
/// 平台配置DTO
/// </summary>
public class PlatformConfigDto
{
    /// <summary>
    /// 是否使用Web支付
    /// </summary>
    [JsonPropertyName("isWebPay")]
    public bool IsWebPay { get; set; } = true;
}


/// <summary>
/// 广告DTO
/// </summary>
public class AdvertDto
{
    /// <summary>
    /// 广告图片URL
    /// </summary>
    [JsonPropertyName("imgurl")]
    public string ImgUrl { get; set; } = string.Empty;

    /// <summary>
    /// 跳转类型
    /// </summary>
    [JsonPropertyName("ttype")]
    public int? Ttype { get; set; }

    /// <summary>
    /// 关联优惠券ID
    /// </summary>
    [JsonPropertyName("coupon_id")]
    public int? CouponId { get; set; }

    /// <summary>
    /// 关联商品ID
    /// </summary>
    [JsonPropertyName("goods_id")]
    public int? GoodsId { get; set; }

    /// <summary>
    /// 跳转链接URL
    /// </summary>
    [JsonPropertyName("url")]
    public string? Url { get; set; }
}
