/**
 * RBAC Management Types & Constants
 */

export interface Tenant {
  id: string
  name: string
  slug: string
  settings: Record<string, any>
  max_users: number
  llm_quota_monthly: number
  status: string
  created_at: string
}

export interface Namespace {
  id: string
  tenant_id: string
  name: string
  slug: string
  parent_namespace_id: string | null
  isolation_level: string
  data_classification: string
  metadata: Record<string, any>
  created_at: string
}

export interface Role {
  id: string
  tenant_id: string | null
  name: string
  description: string
  permissions: string[]
  is_system_role: boolean
  hierarchy_level: number
  created_at: string
}

export interface UserRole {
  id: string
  user_id: string
  role_id: string
  role_name?: string
  tenant_id: string
  namespace_id: string | null
  namespace_name?: string
  granted_by: string
  expires_at: string | null
  created_at: string
}

export interface LLMPolicy {
  id: string
  tenant_id: string
  namespace_id: string | null
  name: string
  allowed_data_categories: string[]
  blocked_data_categories: string[]
  require_pii_redaction: boolean
  pii_redaction_level: string
  allowed_models: string[]
  max_tokens_per_request: number
  max_requests_per_day: number
  created_at: string
}

export type TabId = 'tenants' | 'namespaces' | 'roles' | 'users' | 'policies'

export const TABS: { id: TabId; label: string; icon: string }[] = [
  { id: 'tenants', label: 'Mandanten', icon: 'M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4' },
  { id: 'namespaces', label: 'Namespaces', icon: 'M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4' },
  { id: 'roles', label: 'Rollen', icon: 'M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z' },
  { id: 'users', label: 'Benutzer-Rollen', icon: 'M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z' },
  { id: 'policies', label: 'LLM-Policies', icon: 'M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z' },
]

export const STATUS_COLORS: Record<string, string> = {
  active: 'bg-green-100 text-green-700',
  inactive: 'bg-slate-100 text-slate-500',
  suspended: 'bg-red-100 text-red-700',
}

export const ISOLATION_COLORS: Record<string, string> = {
  strict: 'bg-red-100 text-red-700',
  standard: 'bg-yellow-100 text-yellow-700',
  relaxed: 'bg-green-100 text-green-700',
}

export const DATA_CLASSIFICATION_COLORS: Record<string, string> = {
  restricted: 'bg-red-100 text-red-700',
  confidential: 'bg-orange-100 text-orange-700',
  internal: 'bg-yellow-100 text-yellow-700',
  public: 'bg-green-100 text-green-700',
}

// SDK requests are proxied through nginx on the same origin (no CORS issues)
export const SDK_BASE_URL = ''
