import { SetMetadata } from '@nestjs/common';

export const ROLES_KEY = 'roles';

/**
 * Roles disponibles en el sistema PMC.
 */
export enum UserRole {
  OWNER = 'owner',
  ADMIN = 'admin',
  CREATIVE = 'creative',
  ANALYST = 'analyst',
  VIEWER = 'viewer',
  CLIENT_PORTAL = 'client_portal',
}

/**
 * Decorator para restringir acceso por roles.
 *
 * @example
 * @Roles(UserRole.OWNER, UserRole.ADMIN)
 * @UseGuards(JwtAuthGuard, RolesGuard)
 * @Delete(':id')
 * async remove(@Param('id') id: string) {
 *   return this.service.remove(id);
 * }
 */
export const Roles = (...roles: UserRole[]) => SetMetadata(ROLES_KEY, roles);
