/* ============================================================
   Inspector Mobile — Lookup ixracı
   Mənbə: ObjectsController.GetLookups() ilə eyni cədvəllər.
   Nəticə TƏK bir JSON sətri kimi qayıdır — SSMS-də xanaya klik edib
   tam JSON-u kopyala və mənə göndər.
   ============================================================ */
SELECT
    districts         = JSON_QUERY((SELECT id, ad  AS name, region AS parentId FROM umumi.dbo.bolge       ORDER BY ad FOR JSON PATH)),
    regions           = JSON_QUERY((SELECT id, kod AS name                     FROM umumi.dbo.region      ORDER BY id FOR JSON PATH)),
    destinations      = JSON_QUERY((SELECT id, ad  AS name                     FROM umumi.dbo.teyinat     ORDER BY ad FOR JSON PATH)),
    financeSources    = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.mm        ORDER BY id FOR JSON PATH)),
    statuses          = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.veziyyet  ORDER BY id FOR JSON PATH)),
    results           = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.Rey3      ORDER BY id FOR JSON PATH)),
    conclusions       = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.netice    ORDER BY id FOR JSON PATH)),
    registrationTypes = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.qeydealma ORDER BY id FOR JSON PATH)),
    objectTypes       = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.obyekttip ORDER BY id FOR JSON PATH)),
    permitIssuers     = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.icazeveren ORDER BY id FOR JSON PATH)),
    emdkDestinations  = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.emdx_teyinat ORDER BY id FOR JSON PATH)),
    institutions      = JSON_QUERY((SELECT id, ad  AS name                     FROM mufettis.dbo.institut  ORDER BY id FOR JSON PATH)),
    customerTypes     = JSON_QUERY((SELECT id, ad  AS name                     FROM umumi.dbo.mustip       ORDER BY id FOR JSON PATH)),
    dnjStatuses       = JSON_QUERY((SELECT DISTINCT H.id, H.ad AS name FROM mufettis.dbo.osened O JOIN mufettis.dbo.osenedhal H ON H.id = O.hal WHERE O.sened = 14 FOR JSON PATH)),
    extractStatuses   = JSON_QUERY((SELECT id, ad AS name FROM mufettis.dbo.osenedhal WHERE id IN (1,2,3) ORDER BY id FOR JSON PATH)),
    complexes         = JSON_QUERY((SELECT Id AS id, Name AS name FROM dbo.ViewInspectorObjectComplexes ORDER BY Name FOR JSON PATH)),
    constructionTypes = JSON_QUERY((SELECT DISTINCT ConstructionTypeId AS id, ConstructionTypeName AS name FROM dbo.ViewInspectorObjects WHERE ConstructionTypeId IS NOT NULL FOR JSON PATH)),
    ownershipTypes    = JSON_QUERY((SELECT DISTINCT OwnershipTypeId AS id, OwnershipTypeName AS name FROM dbo.ViewInspectorObjects WHERE OwnershipTypeId IS NOT NULL FOR JSON PATH))
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER;

/* Qeyd: TQR və İHA filtrləri Inspector-da statik siyahıdır (Var / Yoxdur).
   Əgər bunlar üçün ayrıca cədvəl varsa, adını de — sorğu əlavə edərəm. */
