/**
 * List Shares Query DTO
 */

import { IsString, IsOptional, IsEnum, IsInt, Min, Max } from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { PartyShareStatus, PartyShareType } from '../../../domain/enums';

export class ListSharesDto {
  @ApiPropertyOptional({
    description: 'Filter by party ID',
    example: 'user123-server',
  })
  @IsOptional()
  @IsString()
  partyId?: string;

  @ApiPropertyOptional({
    description: 'Filter by status',
    enum: PartyShareStatus,
  })
  @IsOptional()
  @IsEnum(PartyShareStatus)
  status?: PartyShareStatus;

  @ApiPropertyOptional({
    description: 'Filter by share type',
    enum: PartyShareType,
  })
  @IsOptional()
  @IsEnum(PartyShareType)
  shareType?: PartyShareType;

  @ApiPropertyOptional({
    description: 'Filter by public key (hex format)',
  })
  @IsOptional()
  @IsString()
  publicKey?: string;

  @ApiPropertyOptional({
    description: 'Page number (1-based)',
    default: 1,
    minimum: 1,
  })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page?: number = 1;

  @ApiPropertyOptional({
    description: 'Items per page',
    default: 20,
    minimum: 1,
    maximum: 100,
  })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(100)
  limit?: number = 20;
}
