using System.Collections.Generic;

namespace JobTrackerApi.Models
{
    // Read-only analytics/statistics response DTOs. Extracted from
    // JobApplicationsController so the aggregation logic can live in AnalyticsService.
    public sealed record JobStats(
        int Total,
        int Active,
        int Deleted,
        Dictionary<string, int> ByStatus,
        int AppliedLast30Days,
        double AverageDaysSinceApplied
    );

    public sealed record FunnelStagePoint(string Label, int Count);

    public sealed record ResponseRatePoint(string Label, int Total, int Responses, double Rate);

    public sealed record CompanyActivityPoint(int CompanyId, string Company, int Count, int Responses, double ResponseRate);

    public sealed record StageDurationDto(string Stage, double MedianDays, int Count);

    public sealed record SalaryInsightDto(string Currency, string Period, int Count, decimal Minimum, decimal Maximum, decimal AverageMidpoint);

    public sealed record AnalyticsOverviewDto(
        List<FunnelStagePoint> Funnel,
        List<ResponseRatePoint> ResponseRateBySource,
        List<CompanyActivityPoint> TopCompanies,
        double? MedianDaysToFirstResponse,
        int TotalResponses,
        int TotalActive,
        List<StageDurationDto> TimeInStage,
        List<SalaryInsightDto> SalaryInsights
    );
}
