/**
 * Rotate Share Request DTO
 */

import { IsString, IsNotEmpty, IsUUID, Matches } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class RotateShareDto {
  @ApiProperty({
    description: 'MPC rotation session ID',
    example: '550e8400-e29b-41d4-a716-446655440000',
  })
  @IsUUID()
  @IsNotEmpty()
  sessionId: string;

  @ApiProperty({
    description: 'Party ID',
    example: 'user123-server',
  })
  @IsString()
  @IsNotEmpty()
  partyId: string;

  @ApiProperty({
    description: 'Join token from session coordinator',
  })
  @IsString()
  @IsNotEmpty()
  joinToken: string;

  @ApiProperty({
    description: 'Public key of the share to rotate (hex format)',
    example: '03abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab',
  })
  @IsString()
  @IsNotEmpty()
  @Matches(/^(0x)?[a-fA-F0-9]{66}$|^(0x)?[a-fA-F0-9]{130}$/, {
    message: 'publicKey must be a valid compressed or uncompressed public key',
  })
  publicKey: string;
}
