import { IsString, IsOptional, IsEnum, IsArray, IsDateString } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ContentType } from '@prisma/client';

export class CreateFeedDto {
  @ApiProperty({ enum: ContentType }) @IsEnum(ContentType) contentType: ContentType;
  @ApiPropertyOptional() @IsString() @IsOptional() body?: string;
  @ApiPropertyOptional({ type: [String] }) @IsArray() @IsString({ each: true }) @IsOptional() mediaUrls?: string[];

  // Poll fields (used when contentType = POLL)
  @ApiPropertyOptional() @IsString() @IsOptional() pollQuestion?: string;
  @ApiPropertyOptional({ type: [String] }) @IsArray() @IsString({ each: true }) @IsOptional() pollOptions?: string[];
  @ApiPropertyOptional() @IsDateString() @IsOptional() pollEndsAt?: string;
}

export class CreateCommentDto {
  @ApiProperty() @IsString() body: string;
}

export class ReactDto {
  @ApiProperty() @IsString() reactionType: string;
}

export class CreatePollDto {
  @ApiProperty() @IsString() question: string;
  @ApiProperty({ type: [String] }) @IsArray() options: string[];
}
