import { IsEnum, IsArray, IsString, ArrayMinSize } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { BackupTarget } from '@/domain/enums';
import { StorageType } from '@/domain/enums';

export class CreateSnapshotDto {
  @ApiProperty({ enum: StorageType, description: '存储方式' })
  @IsEnum(StorageType)
  storageType: StorageType;

  @ApiProperty({ description: '存储路径 (MinIO 桶路径或描述标签)', example: 'snapshots/2026-02-23' })
  @IsString()
  storagePath: string;

  @ApiProperty({
    enum: BackupTarget,
    isArray: true,
    description: '备份目标列表',
    example: ['POSTGRES', 'REDIS'],
  })
  @IsArray()
  @ArrayMinSize(1)
  @IsEnum(BackupTarget, { each: true })
  targets: BackupTarget[];
}
