📊 Schemas de Dados

Cliente (Client)

{
  id: string (UUID)
  org_id: string (UUID)
  name: string
  slug: string | null
  timezone: string (default: "Europe/Lisbon")
  status: string (default: "active")
  metadata: object | null
  created_at: string (ISO 8601) | null
  email: string | null
  phone: number | null
  plan: string | null
  total_resources: number | null
  services_count: number (default: 0)
  last_contact: string (ISO 8601) | null
  has_risks: boolean (default: false)
}

Serviço (Service)

{
  id: string (UUID)
  client_id: string (UUID)
  name: string
  type: string
  description: string | null
  url: string | null
  admin_url: string | null
  status: string (default: "active")
  plan: string | null (default: "basic")
  environment: string (default: "production")
  credentials: object | null
  deployment_config: object | null
  metadata: object | null
  tags: string[] | null
  health_status: string (default: "healthy")
  last_health_check: string (ISO 8601) | null
  uptime_percentage: number | null
  monthly_cost: number (default: 0)
  billing_cycle: string (default: "monthly")
  next_billing_date: string | null
  version: string | null
  deployed_at: string (ISO 8601) | null
  created_at: string (ISO 8601) | null
  updated_at: string (ISO 8601) | null
}

Ticket

{
  id: string (UUID)
  ticket_code: string
  contact_id: string (UUID)
  subject: string
  description: string
  status: string (default: "open")
  priority: string (default: "normal")
  source: string
  client_id: string (UUID) | null
  service_id: string (UUID) | null
  resource_id: string (UUID) | null
  terminal_id: string (UUID) | null
  assigned_to: string (UUID) | null
  assigned_team: string | null
  tags: string[] | null
  custom_fields: object | null
  created_at: string (ISO 8601) | null
  updated_at: string (ISO 8601) | null
  last_activity_at: string (ISO 8601) | null
}

Recurso (Resource)

{
  id: string (UUID)
  client_id: string (UUID)
  service_id: string (UUID) | null
  name: string
  type: string
  description: string | null
  provider: string (default: "local")
  external_id: string | null
  location: string | null
  ip_address: string | null
  status: string (default: "active")
  specifications: object | null
  credentials: object | null
  limits: object | null
  metadata: object | null
  tags: string[] | null
  health_status: string (default: "healthy")
  last_health_check: string (ISO 8601) | null
  cpu_usage: number | null
  memory_usage: number | null
  storage_usage: number | null
  usage_alerts_enabled: boolean (default: true)
  alert_threshold: number (default: 80)
  monthly_cost: number (default: 0)
  billing_cycle: string (default: "monthly")
  provisioned_at: string (ISO 8601) | null
  created_at: string (ISO 8601) | null
  updated_at: string (ISO 8601) | null
}

Usuário (User)

{
  id: string (UUID)
  email: string
  name: string | null
  phone: string | null
  avatar_url: string | null
  is_superadmin: boolean (default: false)
  is_active: boolean (default: true)
  created_at: string (ISO 8601) | null
  last_login: string (ISO 8601) | null
}

Integração (Integration)

{
  id: string (UUID)
  org_id: string (UUID) | null
  app_code: string
  display_name: string
  secret: string (⚠️ apenas na criação)
  status: string (default: "active")
  metadata: object | null
  created_at: string (ISO 8601) | null
}

Role

{
  id: string (UUID)
  org_id: string (UUID) | null
  code: string
  label: string
  description: string | null
  is_system: boolean (default: false)
  created_at: string (ISO 8601) | null
}

Membership

{
  id: string (UUID)
  user_id: string (UUID)
  org_id: string (UUID)
  client_id: string (UUID) | null
  role_id: string (UUID) | null
  status: string (default: "active")
  metadata: object | null
  created_at: string (ISO 8601) | null
}