using System.Text.Json;
using Tiku.Domain.Content;
using Tiku.Domain.QuestionBanks;

namespace Tiku.Application.QuestionBanks;

public sealed record QuestionBankFilter(
    Guid TenantId,
    Guid? RegionId = null,
    Guid? QuestionBankId = null,
    Guid? SubjectId = null,
    Guid? CategoryId = null,
    Guid? NodeId = null,
    Guid? EntryId = null,
    Guid? ContentNodeId = null,
    Guid? CollectionId = null,
    Guid? QuestionId = null,
    IReadOnlyCollection<Guid>? QuestionIds = null,
    string? Type = null,
    string? Keyword = null,
    int? Limit = null,
    QuestionSource? Source = null);

public sealed record QuestionBankCatalogItem(
    Guid Id,
    Guid? RegionId,
    string Name,
    QuestionSource Source,
    QuestionBankStatus Status,
    JsonElement Metadata);

public sealed record QuestionCatalogItem(
    Guid Id,
    Guid? QuestionBankId,
    Guid? SubjectId,
    Guid? CategoryId,
    Guid? NodeId,
    Guid? EntryId,
    Guid? ContentNodeId,
    Guid? PrimaryCollectionId,
    string? LegacyId,
    string? LegacySubjectId,
    string? LegacyCategoryId,
    string? LegacyNodeId,
    string Type,
    string? TypeLabel,
    int? Difficulty,
    JsonElement Tags,
    JsonElement ExamMarkers,
    string? MediaUrl,
    bool HasVideoExplanation,
    QuestionStatus Status,
    Guid? VersionId,
    int? VersionNo,
    string? Content,
    JsonElement Options,
    int? CorrectOptionIndex,
    JsonElement CorrectOptionIndices,
    string? AnswerText,
    string? Explanation,
    JsonElement SubQuestions,
    string? CodeLang,
    string? CodeTemplate,
    QuestionLocator Locator);

public sealed record QuestionLocator(QuestionSource Source, Guid QuestionId);

public sealed record QuestionVersionCatalogItem(
    Guid Id,
    Guid QuestionId,
    int VersionNo,
    string? Content,
    JsonElement Options,
    int? CorrectOptionIndex,
    JsonElement CorrectOptionIndices,
    string? AnswerText,
    string? Explanation,
    JsonElement SubQuestions,
    string? CodeLang,
    string? CodeTemplate,
    DateTimeOffset CreatedAt);