/**
 * Generic merge base for the OrganizationModel.
 *
 * This constant is used by:
 *   - `resolveOrganizationModel()` as the deep-merge base for every org's config
 *   - Unit tests and snapshot fixtures that need a structurally valid OrganizationModel
 *
 * It does NOT contain Elevasis-specific identity, systems, or action entries.
 * Runtime consumers that need the full Elevasis canonical model should import
 * `canonicalOrganizationModel` from the tenant-owned organization model package instead.
 *
 * Elevasis-specific systems, actions (LEAD_GEN_ACTION_ENTRIES, CRM_ACTION_ENTRIES,
 * DEFAULT_ORGANIZATION_MODEL_ACTIONS), and the platform system description have been
 * relocated to the tenant-owned organization model package.
 */
import type { OrganizationModel } from './types'
import { DEFAULT_ORGANIZATION_MODEL_BRANDING } from './domains/branding'
import { DEFAULT_ORGANIZATION_MODEL_IDENTITY } from './domains/identity'
import { DEFAULT_ORGANIZATION_MODEL_CUSTOMERS } from './domains/customers'
import { DEFAULT_ORGANIZATION_MODEL_OFFERINGS } from './domains/offerings'
import { DEFAULT_ORGANIZATION_MODEL_ROLES } from './domains/roles'
import { DEFAULT_ORGANIZATION_MODEL_GOALS } from './domains/goals'
import { DEFAULT_ORGANIZATION_MODEL_RESOURCES } from './domains/resources'
import { DEFAULT_ORGANIZATION_MODEL_TOPOLOGY } from './domains/topology'
import { DEFAULT_ORGANIZATION_MODEL_POLICIES } from './domains/policies'
import { DEFAULT_ORGANIZATION_MODEL_CLIENTS, DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA } from './schema'
import { DEFAULT_ONTOLOGY_SCOPE } from './ontology'
import type { OrganizationModelNavigation } from './types'

// Phase 4: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE is now a flat Record<id, OrgKnowledgeNode> (D3).
// The old wrapper shape { version, lastModified, nodes[] } is gone; versioning is in domainMetadata.
export const DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {} as const

export const DEFAULT_ORGANIZATION_MODEL_ENTITIES = {}
const DEFAULT_ORGANIZATION_MODEL_NAVIGATION: OrganizationModelNavigation = {
  sidebar: {
    primary: {},
    bottom: {}
  },
  topbar: {}
}

export const DEFAULT_ORGANIZATION_MODEL: OrganizationModel = {
  version: 1,
  domainMetadata: DEFAULT_ORGANIZATION_MODEL_DOMAIN_METADATA,
  branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
  navigation: DEFAULT_ORGANIZATION_MODEL_NAVIGATION,
  identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
  clients: DEFAULT_ORGANIZATION_MODEL_CLIENTS,
  customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
  offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
  roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
  goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
  // Generic empty systems map. Elevasis-specific systems (platform, sales, sales.crm,
  // sales.lead-gen, monitoring, settings, admin, etc.) have been relocated to
  // `@repo/elevasis-core/src/organization-model/systems.ts` via `canonicalOrganizationModel`.
  // Tenant OM configs supply their own systems via `resolveOrganizationModel`.
  systems: {},
  ontology: DEFAULT_ONTOLOGY_SCOPE,
  resources: DEFAULT_ORGANIZATION_MODEL_RESOURCES,
  topology: DEFAULT_ORGANIZATION_MODEL_TOPOLOGY,
  // Generic empty actions map. Elevasis-specific action entries have been relocated to
  // `@repo/elevasis-core/src/organization-model/actions.ts`.
  actions: {},
  entities: DEFAULT_ORGANIZATION_MODEL_ENTITIES,
  policies: DEFAULT_ORGANIZATION_MODEL_POLICIES,
  knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
}
