import {
  IsString,
  IsOptional,
  IsDateString,
  IsObject,
  IsBoolean,
  MaxLength,
} from "class-validator";

/**
 * DTO for updating a credential's metadata
 * Note: Cannot update the credential value itself - use rotate endpoint instead
 */
export class UpdateCredentialDto {
  @IsOptional()
  @IsString({ message: "description must be a string" })
  @MaxLength(1000, { message: "description must not exceed 1000 characters" })
  description?: string;

  @IsOptional()
  @IsDateString({}, { message: "expiresAt must be a valid ISO 8601 date string" })
  expiresAt?: Date;

  @IsOptional()
  @IsObject({ message: "metadata must be an object" })
  metadata?: Record<string, unknown>;

  @IsOptional()
  @IsBoolean({ message: "isActive must be a boolean" })
  isActive?: boolean;
}
