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

namespace Tiku.Api.Contracts;

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

    public Guid? RegionId { get; set; }

    public Guid? UnitId { get; set; }

    public Guid? SubjectId { get; set; }

    public Guid? ChapterId { get; set; }

    public Guid? EntryId { get; set; }

    public Guid? ContentNodeId { get; set; }

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

    public bool IncludeContent { get; set; }

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

    public StudyContentFilter ToFilter(Guid tenantId)
    {
        return new StudyContentFilter(
            tenantId,
            RegionId,
            UnitId,
            SubjectId,
            ChapterId,
            EntryId,
            ContentNodeId,
            Keyword,
            IncludeContent,
            Limit);
    }
}
