/**
 * DTOs for the federation admin controller (FED-M2-08).
 */

import { IsInt, IsNotEmpty, IsOptional, IsString, IsUrl, Max, Min } from 'class-validator';

export class CreatePeerKeypairDto {
  @IsString()
  @IsNotEmpty()
  commonName!: string;

  @IsString()
  @IsNotEmpty()
  displayName!: string;

  @IsOptional()
  @IsUrl()
  endpointUrl?: string;
}

export class StorePeerCertDto {
  @IsString()
  @IsNotEmpty()
  certPem!: string;
}

export class GenerateEnrollmentTokenDto {
  @IsOptional()
  @IsInt()
  @Min(60)
  @Max(900)
  ttlSeconds: number = 900;
}

export class RevokeGrantBodyDto {
  @IsOptional()
  @IsString()
  reason?: string;
}
