import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsMongoId, IsOptional, IsString } from 'class-validator';
import { PaginationQueryDto } from '../../../common/dto/pagination-query.dto';
import { PostVisibility } from '../../../common/enums/post-visibility.enum';
import { POST_SORT_FIELDS, PostSortField } from './post-query.dto';

export class ReelQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({ enum: PostVisibility })
  @IsOptional()
  @IsEnum(PostVisibility)
  visibility?: PostVisibility;

  @ApiPropertyOptional({ description: 'Optional author filter' })
  @IsOptional()
  @IsMongoId()
  authorId?: string;

  @ApiPropertyOptional({ description: 'Search inside reel caption/content' })
  @IsOptional()
  @IsString()
  q?: string;

  @ApiPropertyOptional({ enum: POST_SORT_FIELDS, default: 'createdAt' })
  @IsOptional()
  @IsEnum(POST_SORT_FIELDS)
  sortBy?: PostSortField;
}
