{
  "openapi": "3.0.3",
  "info": {
    "title": "California Cannabis & Distillate Supply Chain Intelligence API",
    "description": "Serverless edge REST APIs powered by Cloudflare Pages and Cloudflare D1 providing verified DCC licenses, dispensary menus, regional municipal policies, policy simulations, and Metrc seed-to-sale traceability.",
    "version": "1.0.0",
    "contact": {
      "name": "Cannabis Supply Chain Intelligence",
      "url": "https://cannabis-supply-chain.pages.dev/"
    }
  },
  "servers": [
    {
      "url": "https://cannabis-supply-chain.pages.dev",
      "description": "Cloudflare Global Edge Production"
    }
  ],
  "paths": {
    "/api/licenses": {
      "get": {
        "summary": "Query California DCC Licenses",
        "description": "Search and filter verified active licenses across cultivators, extractors, distributors, testing labs, and dispensaries.",
        "parameters": [
          {"name": "tier", "in": "query", "schema": {"type": "string"}, "description": "Filter by tier (e.g., 'Tier 0', 'Tier 1', 'Tier 2', 'Tier 3')"},
          {"name": "city", "in": "query", "schema": {"type": "string"}, "description": "Filter by city"},
          {"name": "county", "in": "query", "schema": {"type": "string"}, "description": "Filter by county"},
          {"name": "search", "in": "query", "schema": {"type": "string"}, "description": "Full-text search by DBA, legal name, or license number"}
        ],
        "responses": {
          "200": {"description": "Successful query returning licenses and tier counts"}
        }
      }
    },
    "/api/menus": {
      "get": {
        "summary": "Query Retail Menus and Brand Penetration",
        "description": "Retrieve dispensary menu items, brand market share, and cross-retailer price dispersion serving Burbank zip codes.",
        "parameters": [
          {"name": "brand", "in": "query", "schema": {"type": "string"}},
          {"name": "category", "in": "query", "schema": {"type": "string"}}
        ],
        "responses": {
          "200": {"description": "Returns brand penetration statistics and individual menu SKUs"}
        }
      }
    },
    "/api/municipalities": {
      "get": {
        "summary": "Regional Municipal Comparison",
        "description": "Returns comparative regulatory policies, local gross receipts tax rates, and tax leakage for Burbank, Glendale, Pasadena, West Hollywood, and LA.",
        "responses": {
          "200": {"description": "Returns municipal comparison matrix"}
        }
      }
    },
    "/api/simulate": {
      "get": {
        "summary": "Simulate Burbank Retail Policy Reform",
        "description": "Simulate outcomes of legalizing storefront dispensaries in Burbank.",
        "parameters": [
          {"name": "licenses", "in": "query", "schema": {"type": "integer"}, "description": "Number of retail permits authorized (e.g. 6)"},
          {"name": "taxRate", "in": "query", "schema": {"type": "number"}, "description": "Municipal gross receipts tax rate % (e.g. 6.0)"},
          {"name": "captureRate", "in": "query", "schema": {"type": "number"}, "description": "Local demand recapture rate % (e.g. 75.0)"}
        ],
        "responses": {
          "200": {"description": "Calculates tax receipts, recaptured sales, jobs, and delivery vehicle miles saved"}
        }
      }
    },
    "/api/economics": {
      "get": {
        "summary": "Distillate Value Waterfall Calculator",
        "description": "Compute wholesale unit economics from bulk distillate price ($/L) to consumer receipt.",
        "parameters": [
          {"name": "bulkDistillatePrice", "in": "query", "schema": {"type": "number", "default": 850.0}},
          {"name": "hardwareType", "in": "query", "schema": {"type": "string", "enum": ["pod", "510_cartridge", "disposable"]}},
          {"name": "terpeneType", "in": "query", "schema": {"type": "string", "enum": ["botanical", "cannabis_derived"]}}
        ],
        "responses": {
          "200": {"description": "Returns full unit cost breakdown and value-capture shares"}
        }
      }
    },
    "/api/brands": {
      "get": {
        "summary": "Brand Formulation Teardowns",
        "description": "Retrieve formulation teardowns, hardware IP, and gross margins for STIIIZY, Raw Garden, and Camino.",
        "responses": {
          "200": {"description": "Returns brand deep dive profiles"}
        }
      }
    },
    "/api/metrc": {
      "get": {
        "summary": "Metrc Seed-to-Sale Traceability",
        "description": "Trace 24-character Metrc RFID package tags upstream to agricultural sources.",
        "parameters": [
          {"name": "tag", "in": "query", "schema": {"type": "string"}}
        ],
        "responses": {
          "200": {"description": "Returns parent package lineage path"}
        }
      }
    },
    "/api/testing-supply-chain": {
      "get": {
        "summary": "Query Testing Laboratory Supply Chain and Economics",
        "description": "Retrieve Type 8 testing laboratory profiles, ISO/IEC 17025 accreditations, upstream vendor supply tiers (instrumentation OEMs, certified reference standards, solvents, gases, LIMS), and compliance testing unit COGS economics.",
        "responses": {
          "200": {
            "description": "Returns testing laboratories, upstream supplier tiers, testing panels, and full panel unit economics waterfall"
          }
        }
      }
    },
    "/api/border-storefronts": {
      "get": {
        "summary": "Query Burbank Border Storefronts & Geographic Coordinates",
        "description": "Retrieve geospatial coordinates, distances to the municipal boundary, corridor designations, driving times, and stocked brands for all 10 licensed storefronts and delivery fulfillment depots surrounding Burbank, CA.",
        "responses": {
          "200": {
            "description": "Returns border storefront array with coordinates and Burbank boundary polygon"
          }
        }
      }
    },
    "/api/corporate-structures": {
      "get": {
        "summary": "Query Corporate Structures, Capitalization & Tax Architecture",
        "description": "Retrieve corporate holding company structures, operating subsidiaries (OpCos), IP holding entities (IP HoldCos), capitalization, investors, and IRC § 280E tax mitigation strategies for major cannabis operators supplying Burbank, CA.",
        "responses": {
          "200": {
            "description": "Returns corporate entities dossier and IRC Section 280E tax strategy overview"
          }
        }
      }
    },
    "/api/indoor-growers": {
      "get": {
        "summary": "Query Tier 0 Indoor Cultivators, Economics & Upstream OEMs",
        "description": "Retrieve licensed DCC indoor cultivation facilities, comparative unit economics ($/lb COGS, energy intensity, grams/watt), upstream B2B agricultural equipment suppliers (Fluence, Quest, Athena, Grodan), local suppliers close to Burbank, and biomass feedstock conversion matrices.",
        "responses": {
          "200": {
            "description": "Returns indoor cultivators, comparative cultivation economics, upstream equipment OEMs, local Burbank suppliers, and biomass feedstock matrix"
          }
        }
      }
    },
    "/api/indoor-suppliers": {
      "get": {
        "summary": "Query Indoor Growing Suppliers & Hydroponics Hubs Close to Burbank",
        "description": "Retrieve brick-and-mortar commercial hydroponic superstores, industrial CO2/gas depots (Airgas), precision fertigation plumbing wholesalers (SiteOne), and commercial electrical equipment distributors (CED) located within 0.0 to 5.5 miles of Burbank. Supports category and max_distance query filtering.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Filter by supplier category (e.g., 'Hydroponics', 'Gas', 'Irrigation', 'Electrical')"
          },
          {
            "name": "max_distance",
            "in": "query",
            "required": false,
            "schema": { "type": "number" },
            "description": "Maximum distance from Burbank border in miles (e.g., 2.5)"
          }
        ],
        "responses": {
          "200": {
            "description": "Returns list of local indoor cultivation suppliers sorted by distance from Burbank"
          }
        }
      }
    },
    "/api/packaging-compliance": {
      "get": {
        "summary": "Query Secondary Packaging, Child-Resistant Standards & OEMs",
        "description": "Retrieve certified child-resistant packaging suppliers (16 CFR § 1700.20 / ASTM D3475), tamper-evident requirements (DCC 4 CCR § 15406), and unit packaging cost waterfalls for vape pods and flower.",
        "responses": {
          "200": {
            "description": "Returns packaging suppliers, regulatory framework mandates, and unit packaging waterfall"
          }
        }
      }
    },
    "/api/cash-and-banking": {
      "get": {
        "summary": "Query Cash Management, Armored Transport & FinCEN Banking",
        "description": "Retrieve financial institutions providing commercial cannabis accounts, FinCEN BSA/AML Suspicious Activity Report (SAR) categories, armored transport operators, and retail payment mixes.",
        "responses": {
          "200": {
            "description": "Returns financial institutions, armored transport operators, and FinCEN SAR framework"
          }
        }
      }
    },
    "/api/rescheduling-scenarios": {
      "get": {
        "summary": "Query DEA Schedule III Rescheduling, 280E Elimination & Interstate Trade",
        "description": "Retrieve comparative tax models evaluating the elimination of IRC § 280E under Schedule III, storefront financial sensitivity models, and interstate commerce trade corridors under CA SB 1326.",
        "responses": {
          "200": {
            "description": "Returns rescheduling tax models, 1M retail P&L transformation, and interstate trade corridors"
          }
        }
      }
    },
    "/api/illegal-grows": {
      "get": {
        "summary": "Query Illegal Grow Houses, Toxic Pesticides & Enforcement",
        "description": "Retrieve illicit cultivation typologies (suburban box grows, industrial ghost grows, high desert compounds), banned pesticide toxicology (Myclobutanil/HCN, Carbofuran, Paclobutrazol), utility power theft economics, and inter-agency task force data.",
        "responses": {
          "200": {
            "description": "Returns illegal grow typologies, chemical hazards, 50-light grow economics, and law enforcement agencies"
          }
        }
      }
    }
  }
}



