import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsInt, IsOptional, Min, ValidateIf } from 'class-validator';

/** `GET /v1/zoom/general-links` query. Exactly one of `programId` / `sessionId` scopes the list, same as the generate endpoint. */
export class ListZoomGeneralLinksV1Dto {
  @ApiPropertyOptional({ description: 'Lists generated links across every session of this program.' })
  @ValidateIf((dto) => !dto.sessionId)
  @Type(() => Number)
  @IsInt()
  programId?: number;

  @ApiPropertyOptional({ description: 'Lists generated links for this one session only.' })
  @ValidateIf((dto) => !dto.programId)
  @Type(() => Number)
  @IsInt()
  sessionId?: number;

  @ApiPropertyOptional({ default: 1 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page: number = 1;

  @ApiPropertyOptional({ default: 20 })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  limit: number = 20;
}
