using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Mvc;

namespace HoneyBox.Model.Models;

/// <summary>
/// 分页请求基类
/// </summary>
public class PageRequest
{
    /// <summary>
    /// 页码，从1开始
    /// </summary>
    [JsonPropertyName("page")]
    [FromQuery(Name = "page")]
    public int Page { get; set; } = 1;

    /// <summary>
    /// 每页数量
    /// </summary>
    [JsonPropertyName("page_size")]
    [FromQuery(Name = "page_size")]
    public int PageSize { get; set; } = 10;
}

/// <summary>
/// 分页响应基类 (兼容PHP API格式)
/// </summary>
/// <typeparam name="T">数据类型</typeparam>
public class PageResponse<T>
{
    /// <summary>
    /// 数据列表
    /// </summary>
    [JsonPropertyName("data")]
    public List<T> Data { get; set; } = new();

    /// <summary>
    /// 最后一页页码 (兼容PHP API)
    /// </summary>
    [JsonPropertyName("last_page")]
    public int LastPage { get; set; }

    /// <summary>
    /// 总数量
    /// </summary>
    [JsonPropertyName("total")]
    public int Total { get; set; }

    /// <summary>
    /// 当前页码
    /// </summary>
    [JsonPropertyName("page")]
    public int Page { get; set; }

    /// <summary>
    /// 每页数量
    /// </summary>
    [JsonPropertyName("page_size")]
    public int PageSize { get; set; }
}

/// <summary>
/// ID请求基类
/// </summary>
public class IdRequest
{
    /// <summary>
    /// ID
    /// </summary>
    [JsonPropertyName("id")]
    public int Id { get; set; }
}

/// <summary>
/// 批量ID请求基类
/// </summary>
public class IdsRequest
{
    /// <summary>
    /// ID列表
    /// </summary>
    [JsonPropertyName("ids")]
    public List<int> Ids { get; set; } = new();
}
