using System.ComponentModel.DataAnnotations;
using Tiku.Application.Scoreline;

namespace Tiku.Api.Contracts;

public sealed class ScorelineQueryDto
{
    [StringLength(100)]
    public string? TenantCode { get; set; }

    public Guid? RegionId { get; set; }
    public Guid? SchoolId { get; set; }
    public Guid? MajorId { get; set; }

    [StringLength(100)]
    public string? Keyword { get; set; }

    [Range(1900, 3000)]
    public int? Year { get; set; }

    [Range(1, 10000)]
    public int? Page { get; set; }

    [Range(1, 200)]
    public int? PageSize { get; set; }

    [Range(1, 2000)]
    public int? Limit { get; set; }

    public ScorelineFilter ToFilter(
        Guid tenantId,
        IReadOnlyCollection<ScorelineDynamicFilter>? dynamicFilters = null)
    {
        return new ScorelineFilter(
            tenantId,
            RegionId,
            SchoolId,
            MajorId,
            Keyword,
            Year,
            Page,
            PageSize,
            Limit,
            dynamicFilters);
    }
}
