/**
 * Resource Type Metadata
 *
 * Centralized metadata for ResourceDefinition types including icon names and colors.
 * Icon names reference @tabler/icons-react - UI layer maps these to actual components.
 */

import type { ResourceDefinition } from './types'

/**
 * All valid resource types from ResourceDefinition
 * Derived from the base interface to ensure consistency
 */
export type ResourceDefinitionType = ResourceDefinition['type']

/**
 * Node color types for graph visualization
 * Used by both @repo/core (metadata) and @repo/ui (components)
 */
export type NodeColorType = 'violet' | 'blue' | 'orange' | 'teal' | 'gray' | 'yellow'

/**
 * Tabler icon names for each resource type
 * UI packages map these strings to actual icon components
 */
export const resourceTypeIconNames: Record<ResourceDefinitionType, string> = {
  agent: 'IconBrain',
  workflow: 'IconGitBranch',
  trigger: 'IconBolt',
  integration: 'IconPlug',
  external: 'IconExternalLink',
  human: 'IconUser'
}

/**
 * Mantine color names for each resource type
 */
export const resourceTypeColors: Record<ResourceDefinitionType, NodeColorType> = {
  agent: 'violet',
  workflow: 'blue',
  trigger: 'orange',
  integration: 'teal',
  external: 'gray',
  human: 'yellow'
}

/**
 * Get icon name for a resource type
 */
export function getResourceIconName(type: ResourceDefinitionType): string {
  return resourceTypeIconNames[type]
}

/**
 * Get color for a resource type
 */
export function getResourceColor(type: ResourceDefinitionType): NodeColorType {
  return resourceTypeColors[type]
}
