/**
 * DTO for adding attachments to an existing entity.
 *
 * This DTO is used to associate one or more attachment files
 * with a specific record based on its ID and type.
 *
 * Typical usage:
 * - Linking uploaded documents to a menu group or related module
 * - Supporting multiple attachments in a single request
 */
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsArray, IsOptional, IsString } from 'class-validator';

export class AddAttachmentDto {
  /**
   * Identifier of the parent entity.
   *
   * Represents the record to which the attachments
   * should be linked.
   *
   * Expected as a string to support numeric IDs
   * sent from HTTP requests.
   */
  @IsString()
  id: string;

  /**
   * Entity or module type.
   *
   * Used by the service layer to determine:
   * - Attachment context
   * - Storage location
   * - Relation mapping
   *
   * Example values:
   * - "menu_group"
   * - "menu"
   * - "permission"
   */
  @IsString()
  type: string;

  /**
   * Attachment file identifiers.
   *
   * Contains a list of file names or file reference keys
   * generated during the upload process.
   *
   * Behavior:
   * - Optional field
   * - Supports multiple attachments
   * - If omitted, no attachment changes are made
   */
  @ApiPropertyOptional({ type: [String] })
  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  attachment_file?: string[];
}
