import {
  IsInt,
  IsNotEmpty,
  IsObject,
  IsOptional,
  IsString,
  MaxLength,
} from 'class-validator';

export class SaveAnnotationDto {
  @IsString()
  @IsNotEmpty()
  @MaxLength(128)
  anonymousSessionId!: string;

  @IsOptional()
  @IsInt()
  activityId?: number;

  @IsOptional()
  @IsInt()
  mediaId?: number;

  @IsOptional()
  @IsString()
  @MaxLength(128)
  entityType?: string;

  @IsOptional()
  @IsInt()
  entityId?: number;

  @IsObject()
  annotationsJson!: Record<string, any>;

  @IsOptional()
  @IsString()
  @MaxLength(1024)
  previewImagePath?: string;
}

export class UpdateAnnotationDto {
  @IsString()
  @IsNotEmpty()
  @MaxLength(128)
  anonymousSessionId!: string;

  @IsOptional()
  @IsObject()
  annotationsJson?: Record<string, any>;

  @IsOptional()
  @IsString()
  @MaxLength(1024)
  previewImagePath?: string;
}
