-- .ghci-core — loads ONLY Layer 1 (Generated.Types, Web.Types) and Layer 2
-- (Application/Helper/*) for independent compilation verification.
--
-- Usage (inside devenv shell):
--   ghci -ghci-script .ghci-core
-- or:
--   ghcid --command "ghci -ghci-script .ghci-core"
--
-- This file intentionally does NOT load Main.hs or any Web/Controller / Web/View
-- modules. Once this reaches "Ok, N modules loaded" with no errors, the core
-- layer is verified clean and Layer 3 errors are isolated to controllers/views.

-- NOTE: we do NOT use :loadFromIHP applicationGhciConfig here because it ends
-- with ":l Main.hs" which would load all of Layer 3.  Instead we duplicate
-- the environment flags from applicationGhciConfig and load only core modules.
:set -i.
:set -iIHP/ihp-hsx
:set -iConfig
:set -ibuild
:set -iIHP
:set -XOverloadedStrings
:set -XNoImplicitPrelude
:set -XImplicitParams
:set -XRank2Types
:set -XDisambiguateRecordFields
:set -XNamedFieldPuns
:set -XDuplicateRecordFields
:set -XOverloadedLabels
:set -XFlexibleContexts
:set -XTypeSynonymInstances
:set -XFlexibleInstances
:set -XQuasiQuotes
:set -XTypeFamilies
:set -XPackageImports
:set -XScopedTypeVariables
:set -XRecordWildCards
:set -XTypeApplications
:set -XDataKinds
:set -XInstanceSigs
:set -XDeriveGeneric
:set -XMultiParamTypeClasses
:set -XTypeOperators
:set -XUndecidableInstances
:set -Wno-unsafe -Wno-name-shadowing -Wno-monomorphism-restriction -Wno-safe -Wno-missing-local-signatures -Wno-missing-home-modules
:set -XDeriveDataTypeable
:set -XLambdaCase
:set -XDefaultSignatures
:set -XEmptyDataDeriving
:set -XBangPatterns
:set -XBlockArguments
:set -XMultiWayIf
:set -XFunctionalDependencies
:set -package ihp
:set -fbyte-code
:set -j1
:set -fkeep-going
:set -Wno-partial-type-signatures
:set -XPartialTypeSignatures
:set -XStandaloneDeriving
:set -XDerivingVia
:set -XTemplateHaskell
:set -XDeepSubsumption
:set -XOverloadedRecordDot
:set -Werror=missing-fields
:set -fwarn-incomplete-patterns
:set -package ghc
:set -fno-warn-ambiguous-fields

-- Layer 1: generated types and Web.Types
:load build/Generated/Types.hs Web/Types.hs Web/Routes.hs

-- Layer 2: helpers (order matters — imports within Layer 2 must be satisfied)
:add Application/Helper/View.hs
:add Application/Helper/Controller.hs
:add Application/Helper/TypeRegistry.hs
:add Application/Helper/ModelRouter.hs
:add Application/Helper/RoutingEngine.hs
:add Application/Helper/FrictionScore.hs
:add Application/Helper/BottleneckDetector.hs
:add Application/Helper/HubHealth.hs
:add Application/Helper/CorrelationEngine.hs
:add Application/Helper/CrossHubPropagation.hs
:add Application/Helper/AgentBridge.hs
:add Application/Helper/ApiRateLimit.hs
