import { Type } from 'class-transformer';
import { IsArray, IsOptional, IsUUID, ValidateNested } from 'class-validator';

export class RoleHierarchyLinkDto {
  @IsUUID()
  role_id: string;

  /** Null (or omitted) places the role at the root of the tree. */
  @IsOptional()
  @IsUUID()
  parent_role_id?: string | null;
}

export class UpdateRoleHierarchyDto {
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => RoleHierarchyLinkDto)
  links: RoleHierarchyLinkDto[];
}
