import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsArray, IsOptional, IsString } from 'class-validator';

/**
 * DTO for adding attachments to a specific entity.
 *
 * This DTO contains the entity identifier, the type of attachment,
 * and an optional array of attachment file names or paths.
 */
export class AddAttachmentDto {
  /**
   * ID of the entity to which attachments are being added.
   * Required field.
   * Example: "123"
   */
  @IsString()
  id: string;

  /**
   * Type of attachment (e.g., "invoice", "document", etc.).
   * Required field.
   * Example: "invoice"
   */
  @IsString()
  type: string;

  /**
   * Optional array of attachment file names or paths.
   * Each element must be a string.
   * Example: ["file1.pdf", "file2.jpg"]
   */
  @ApiPropertyOptional({ type: [String] })
  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  attachment_file?: string[];
}
