export type FacadeRuntimeMode = 'production' | 'mock'

export type FacadeRuntimeProfile = {
  mode: FacadeRuntimeMode
  geometry: {
    engine: 'bitbybit-occt'
    execution: 'facade-runtime'
    compatibility: 'none' | 'demo-bootstrap'
  }
  nativeHistory: {
    transport: 'optional-worker'
    availability: 'configured-at-application-boundary' | 'not-configured'
  }
  naming: {
    nativeAbi: 'freecad-private-v1-optional-worker' | 'not-exposed'
    preservation: 'opaque-preserved'
  }
  persistence: 'sqlite-opfs-with-memory-fallback'
  viewport: 'three-webgl2'
}

export const createFacadeRuntimeProfile = (mode: FacadeRuntimeMode): FacadeRuntimeProfile => ({
  mode,
  geometry: {
    engine: 'bitbybit-occt',
    execution: 'facade-runtime',
    compatibility: mode === 'mock' ? 'demo-bootstrap' : 'none',
  },
  nativeHistory: {
    transport: 'optional-worker',
    availability: 'not-configured',
  },
  naming: {
    nativeAbi: mode === 'production' ? 'freecad-private-v1-optional-worker' : 'not-exposed',
    preservation: 'opaque-preserved',
  },
  persistence: 'sqlite-opfs-with-memory-fallback',
  viewport: 'three-webgl2',
})
