// Services/Interfaces/IAiAnalysisService.cs
using Services.AIViewModel;
namespace Services.Interaces
{
///
/// Unified AI analysis service powered by Claude API (Anthropic).
/// Provides sentiment analysis, risk assessment, key phrase extraction,
/// PII anonymization, workplace insights, and executive reporting.
///
public interface IAiAnalysisService
{
#region Core Analysis Methods
///
/// Analyzes sentiment of response text (Positive, Negative, Neutral)
/// with confidence scores using Claude AI.
///
Task AnalyzeSentimentAsync(string text);
///
/// Extracts key phrases, workplace factors, and emotional indicators
/// from response text using Claude AI.
///
Task ExtractKeyPhrasesAsync(string text);
///
/// Removes PII (names, emails, phone numbers, addresses) from text
/// using Claude AI entity recognition.
///
Task AnonymizeTextAsync(string text);
///
/// Detects named entities in text (people, organizations, locations, roles).
///
Task> DetectEntitiesAsync(string text);
#endregion
#region Risk Assessment Methods
///
/// Assesses mental health risk level (Low → Critical) with indicators,
/// protective factors, and recommended actions using Claude AI.
///
Task AssessMentalHealthRiskAsync(string anonymizedText, string questionContext);
///
/// Generates workplace insights and intervention recommendations
/// categorized by priority and affected areas.
///
Task> GenerateWorkplaceInsightsAsync(string anonymizedText, string questionContext);
///
/// Creates a professional executive summary from aggregated analysis results
/// suitable for C-level reporting.
///
Task GenerateExecutiveSummaryAsync(List analysisResults);
///
/// Categorizes response into workplace mental health themes
/// (Work-Life Balance, Burnout, Leadership, etc.).
///
Task> CategorizeResponseAsync(string anonymizedText);
#endregion
#region Composite Analysis Methods
///
/// Performs full analysis pipeline on a single response:
/// Anonymize → Sentiment → Key Phrases → Risk → Insights.
///
Task AnalyzeCompleteResponseAsync(AnalysisRequest request);
///
/// Analyzes multiple responses for a specific question.
///
Task> AnalyzeQuestionResponsesAsync(int questionId, List requests);
///
/// Generates comprehensive analysis overview for an entire questionnaire
/// including sentiment distribution, risk breakdown, and executive summary.
///
Task GenerateQuestionnaireOverviewAsync(int questionnaireId);
///
/// Batch processes multiple responses with rate-limit-aware concurrency.
///
Task> BatchAnalyzeResponsesAsync(List requests);
#endregion
#region Mental Health Intelligence
///
/// Identifies responses flagged as High or Critical risk
/// requiring immediate organizational attention.
///
Task> IdentifyHighRiskResponsesAsync(int questionnaireId);
///
/// Analyzes mental health trends across a date range.
///
Task> AnalyzeMentalHealthTrendsAsync(int questionnaireId, DateTime fromDate, DateTime toDate);
///
/// Compares mental health metrics across team identifiers.
///
Task> CompareTeamMentalHealthAsync(int questionnaireId, List teamIdentifiers);
///
/// Generates prioritized intervention recommendations based on analysis.
///
Task> GenerateInterventionRecommendationsAsync(int questionnaireId);
#endregion
#region Reporting
///
/// Creates a detailed markdown analysis report for management review.
///
Task GenerateDetailedAnalysisReportAsync(int questionnaireId);
///
/// Exports fully anonymized analysis data for external processing.
///
Task> ExportAnonymizedAnalysisAsync(int questionnaireId);
///
/// Generates management dashboard data with KPIs and summaries.
///
Task GenerateManagementDashboardAsync(int questionnaireId);
#endregion
#region Service Health
///
/// Tests the Claude API connection with a minimal request.
///
Task TestClaudeConnectionAsync();
///
/// Validates an analysis request before processing.
///
Task ValidateAnalysisRequestAsync(AnalysisRequest request);
///
/// Returns service health status. Key: "Claude", Value: online/offline.
///
Task> GetServiceHealthStatusAsync();
#endregion
}
}