namespace TakeoutSaaS.TenantApi.Contracts.Finance;

/// <summary>
/// 到账统计请求。
/// </summary>
public sealed class FinanceSettlementStatsRequest
{
    /// <summary>
    /// 门店 ID。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;
}

/// <summary>
/// 到账筛选请求。
/// </summary>
public class FinanceSettlementFilterRequest
{
    /// <summary>
    /// 门店 ID。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;

    /// <summary>
    /// 开始日期（yyyy-MM-dd）。
    /// </summary>
    public string? StartDate { get; set; }

    /// <summary>
    /// 结束日期（yyyy-MM-dd）。
    /// </summary>
    public string? EndDate { get; set; }

    /// <summary>
    /// 渠道（wechat/alipay）。
    /// </summary>
    public string? Channel { get; set; }
}

/// <summary>
/// 到账列表请求。
/// </summary>
public sealed class FinanceSettlementListRequest : FinanceSettlementFilterRequest
{
    /// <summary>
    /// 页码。
    /// </summary>
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页条数。
    /// </summary>
    public int PageSize { get; set; } = 20;
}

/// <summary>
/// 到账明细请求。
/// </summary>
public sealed class FinanceSettlementDetailRequest
{
    /// <summary>
    /// 门店 ID。
    /// </summary>
    public string StoreId { get; set; } = string.Empty;

    /// <summary>
    /// 到账日期（yyyy-MM-dd）。
    /// </summary>
    public string ArrivedDate { get; set; } = string.Empty;

    /// <summary>
    /// 渠道（wechat/alipay）。
    /// </summary>
    public string Channel { get; set; } = string.Empty;
}

/// <summary>
/// 到账统计响应。
/// </summary>
public sealed class FinanceSettlementStatsResponse
{
    /// <summary>
    /// 今日到账。
    /// </summary>
    public decimal TodayArrivedAmount { get; set; }

    /// <summary>
    /// 昨日到账。
    /// </summary>
    public decimal YesterdayArrivedAmount { get; set; }

    /// <summary>
    /// 本月到账。
    /// </summary>
    public decimal CurrentMonthArrivedAmount { get; set; }

    /// <summary>
    /// 本月交易笔数。
    /// </summary>
    public int CurrentMonthTransactionCount { get; set; }
}

/// <summary>
/// 到账账户信息响应。
/// </summary>
public sealed class FinanceSettlementAccountResponse
{
    /// <summary>
    /// 银行名称。
    /// </summary>
    public string BankName { get; set; } = string.Empty;

    /// <summary>
    /// 开户名。
    /// </summary>
    public string BankAccountName { get; set; } = string.Empty;

    /// <summary>
    /// 脱敏银行账号。
    /// </summary>
    public string BankAccountNoMasked { get; set; } = string.Empty;

    /// <summary>
    /// 脱敏微信商户号。
    /// </summary>
    public string WechatMerchantNoMasked { get; set; } = string.Empty;

    /// <summary>
    /// 脱敏支付宝 PID。
    /// </summary>
    public string AlipayPidMasked { get; set; } = string.Empty;

    /// <summary>
    /// 结算周期文案。
    /// </summary>
    public string SettlementPeriodText { get; set; } = string.Empty;
}

/// <summary>
/// 到账列表行响应。
/// </summary>
public sealed class FinanceSettlementListItemResponse
{
    /// <summary>
    /// 到账日期。
    /// </summary>
    public string ArrivedDate { get; set; } = string.Empty;

    /// <summary>
    /// 渠道编码。
    /// </summary>
    public string Channel { get; set; } = string.Empty;

    /// <summary>
    /// 渠道文案。
    /// </summary>
    public string ChannelText { get; set; } = string.Empty;

    /// <summary>
    /// 交易笔数。
    /// </summary>
    public int TransactionCount { get; set; }

    /// <summary>
    /// 到账金额。
    /// </summary>
    public decimal ArrivedAmount { get; set; }
}

/// <summary>
/// 到账列表响应。
/// </summary>
public sealed class FinanceSettlementListResultResponse
{
    /// <summary>
    /// 列表项。
    /// </summary>
    public List<FinanceSettlementListItemResponse> Items { get; set; } = [];

    /// <summary>
    /// 总数。
    /// </summary>
    public int Total { get; set; }

    /// <summary>
    /// 页码。
    /// </summary>
    public int Page { get; set; }

    /// <summary>
    /// 每页条数。
    /// </summary>
    public int PageSize { get; set; }
}

/// <summary>
/// 到账明细行响应。
/// </summary>
public sealed class FinanceSettlementDetailItemResponse
{
    /// <summary>
    /// 订单号。
    /// </summary>
    public string OrderNo { get; set; } = string.Empty;

    /// <summary>
    /// 金额。
    /// </summary>
    public decimal Amount { get; set; }

    /// <summary>
    /// 支付时间。
    /// </summary>
    public string PaidAt { get; set; } = string.Empty;
}

/// <summary>
/// 到账明细响应。
/// </summary>
public sealed class FinanceSettlementDetailResultResponse
{
    /// <summary>
    /// 明细列表。
    /// </summary>
    public List<FinanceSettlementDetailItemResponse> Items { get; set; } = [];
}

/// <summary>
/// 到账导出响应。
/// </summary>
public sealed class FinanceSettlementExportResponse
{
    /// <summary>
    /// 文件名。
    /// </summary>
    public string FileName { get; set; } = string.Empty;

    /// <summary>
    /// 文件内容（Base64）。
    /// </summary>
    public string FileContentBase64 { get; set; } = string.Empty;

    /// <summary>
    /// 导出总数。
    /// </summary>
    public int TotalCount { get; set; }
}
