import { ApiProperty } from '@nestjs/swagger';

export class QuestionStatDto {
  @ApiProperty({ description: 'Question identifier' })
  questionId: string;

  @ApiProperty({ description: 'Question label' })
  label: string;

  @ApiProperty({ description: 'Count of responses for this option' })
  count: number;
}

export class SurveyDetailDto {
  @ApiProperty({ description: 'Survey ID' })
  id: number;

  @ApiProperty({ description: 'Survey title' })
  title: string;

  @ApiProperty({ description: 'Survey description' })
  description: string;

  @ApiProperty({ description: 'Total responses received' })
  totalResponses: number;

  @ApiProperty({ description: 'Target audience' })
  targetAudience: any;

  @ApiProperty({ description: 'Creation date' })
  createdAt: string;

  @ApiProperty({ description: 'Closing date' })
  closingDate?: string | null;

  @ApiProperty({ description: 'Question statistics', type: [QuestionStatDto] })
  // @ApiProperty({ description: 'Question statistics' })
  questionStats: QuestionStatDto[];
  // questionStats: any;
}

export class SurveyStatisticsResponseDto {
  @ApiProperty({ description: 'Total number of surveys' })
  totalSurveys: number;

  @ApiProperty({ description: 'Total number of responses across all surveys' })
  totalResponses: number;

  @ApiProperty({ description: 'Completion rate percentage' })
  completionRate: number;

  @ApiProperty({ description: 'Surveys created by month' })
  surveysByMonth: { month: string; count: number }[];

  @ApiProperty({ description: 'Responses by audience type' })
  responsesByAudience: { name: any; value: number }[];

  @ApiProperty({ description: 'Response distribution by survey' })
  responseDistribution: { title: string; responses: number }[];

  @ApiProperty({ description: 'Detailed statistics for each survey', type: [SurveyDetailDto] })
  surveyDetails: SurveyDetailDto[];
}