/* Global configuration ------------------------------------------------ */
window.APP_CONFIG = {
    /* Base URL of the ASP.NET Inspector backend.
       Empty string = same origin. When the PWA is hosted on a different
       domain, set e.g. "https://inspector.example.gov.az" and make sure the
       backend enables CORS with AllowCredentials + this origin. */
    apiBase: '',

    /* While the backend is not wired up, views render mock data.
       Flip to false (or call App.setLive(true)) to hit the real endpoints. */
    useMock: true,

    /* Antiforgery token endpoint (returns { token } or a raw string). */
    csrfUrl: '/Settings/GetRequestVerificationToken',
    csrfHeader: 'RequestVerificationToken',

    /* Google Maps JS API key (Maps JavaScript API must be enabled for it). */
    gmapKey: 'AIzaSyDX727-bMtaqCX-WseAh6Md_547HKLxgm0'
};

/* Backend endpoint map — mirrors the existing ObjectsController / Report /
   Reviews JSON actions so views can be wired one-by-one. */
window.ENDPOINTS = {
    objects:          { url: '/Objects/GetObjects',                 method: 'post', dx: true },
    objectInfo:       { url: '/Objects/GetObjectInfo',              method: 'get' },
    lookups:          { url: '/Objects/GetLookups',                 method: 'get' },
    assistantSearch:  { url: '/Objects/AssistantSearchObjects',     method: 'get' },
    createObject:     { url: '/Objects/CreateObject',               method: 'post' },
    updateObject:     { url: '/Objects/UpdateObject',               method: 'post' },

    stages:           { url: '/Objects/GetObjectStages',            method: 'post', dx: true },
    documents:        { url: '/Objects/GetObjectDocuments',         method: 'post', dx: true },
    violations:       { url: '/Objects/GetObjectCriterionViolations', method: 'post', dx: true },
    inspections:      { url: '/Objects/GetObjectTechnicalReviews',  method: 'post', dx: true },
    measures:         { url: '/Objects/GetObjectMeasures',          method: 'post', dx: true },
    measureRegistry:  { url: '/Report/GetMeasureRegistry',          method: 'post', dx: true },
    expertise:        { url: '/Objects/GetObjectExpertiseLinks',    method: 'post', dx: true },
    licenses:         { url: '/Objects/GetObjectCompanies',         method: 'post', dx: true },
    gisH3:            { url: '/Report/GetH3Objects',                method: 'post', dx: true }
};

/* Navigation / feature registry — the 12 mobile sections. */
window.SECTIONS = [
    { id: 'objects',     title: 'Obyektlərin siyahısı', short: 'Obyektlər', icon: 'fa-light fa-buildings',            component: 'objects-view',  kind: 'objects' },
    { id: 'search',      title: 'Axtarış / Filter',     short: 'Axtarış',   icon: 'fa-light fa-magnifying-glass',      component: 'search-view',   kind: 'search' },
    { id: 'new',         title: 'Yeni Obyekt',          short: 'Yeni',      icon: 'fa-light fa-square-plus',           component: 'new-object-view', kind: 'new' },
    { id: 'stages',      title: 'Mərhələlər',           short: 'Mərhələ',   icon: 'fa-light fa-timeline',              component: 'registry-view', kind: 'stages' },
    { id: 'documents',   title: 'Sənədlər',             short: 'Sənəd',     icon: 'fa-light fa-file-lines',            component: 'registry-view', kind: 'documents' },
    { id: 'violations',  title: 'Pozuntular',           short: 'Pozuntu',   icon: 'fa-light fa-triangle-exclamation',  component: 'registry-view', kind: 'violations' },
    { id: 'inspections', title: 'Texniki baxış',        short: 'Tex. baxış',icon: 'fa-light fa-clipboard-check',       component: 'registry-view', kind: 'inspections' },
    { id: 'measures',    title: 'Tədbirlər',            short: 'Tədbir',    icon: 'fa-light fa-gavel',                 component: 'registry-view', kind: 'measures' },
    { id: 'expertise',   title: 'Ekspertiza',           short: 'Eksper.',   icon: 'fa-light fa-microscope',            component: 'registry-view', kind: 'expertise' },
    { id: 'licenses',    title: 'Lisenziyalar',         short: 'Lisenziya', icon: 'fa-light fa-id-card-clip',          component: 'registry-view', kind: 'licenses' },
    { id: 'map',         title: 'Müfəttiş xəritə',      short: 'Xəritə',    icon: 'fa-light fa-map-location-dot',      component: 'map-view',      kind: 'map' },
    { id: 'gis',         title: 'GIS Monitorinq',       short: 'GIS',       icon: 'fa-light fa-earth-asia',            component: 'gis-view',      kind: 'gis' }
];

/* Which sections show in the phone bottom bar (max 4 + "More"). */
window.PRIMARY_TABS = ['objects', 'map', 'gis', 'new'];
