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

namespace Tiku.Api.Contracts;

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

    public Guid? RegionId { get; set; }

    public Guid? SubjectId { get; set; }

    public Guid? CategoryId { get; set; }

    public Guid? ContentNodeId { get; set; }

    public Guid? QuestionId { get; set; }

    public Guid? AssetId { get; set; }

    [StringLength(50)]
    public string? AssetType { get; set; }

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

    [StringLength(200)]
    public string? AssetKey { get; set; }

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

    public bool IncludeLocked { get; set; }

    public bool IncludeInactive { get; set; }

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

    public AssetFilter ToFilter(Guid tenantId)
    {
        return new AssetFilter(
            tenantId,
            RegionId,
            SubjectId,
            CategoryId,
            ContentNodeId,
            QuestionId,
            AssetId,
            AssetType,
            Category,
            AssetKey,
            Keyword,
            IncludeLocked,
            IncludeInactive,
            Limit);
    }
}
