import { IsDateString, IsIn, IsObject, IsOptional, IsString, IsUUID } from 'class-validator';

export class CreateGrantDto {
  @IsUUID()
  peerId!: string;

  @IsUUID()
  subjectUserId!: string;

  @IsObject()
  scope!: Record<string, unknown>;

  @IsOptional()
  @IsDateString()
  expiresAt?: string;
}

export class ListGrantsDto {
  @IsOptional()
  @IsUUID()
  peerId?: string;

  @IsOptional()
  @IsUUID()
  subjectUserId?: string;

  @IsOptional()
  @IsIn(['pending', 'active', 'revoked', 'expired'])
  status?: 'pending' | 'active' | 'revoked' | 'expired';
}

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