{
  "$schema": "https://developer.microsoft.com/json-schemas/office-js/custom-functions.schema.json",
  "functions": [
    {
      "id": "DIGIPIN",
      "name": "DIGIPIN",
      "description": "Encode lat/lng to a DIGIPIN code (India only).",
      "helpUrl": "https://www.indiapost.gov.in/digipin",
      "result": { "type": "string" },
      "parameters": [
        { "name": "lat", "description": "Latitude (2.5 to 38.5)", "type": "number" },
        { "name": "lng", "description": "Longitude (63.5 to 99.5)", "type": "number" },
        { "name": "precision", "description": "Code length 4-10 (default 10 ≈ 4m × 4m)", "type": "number", "optional": true }
      ]
    },
    {
      "id": "DIGIPIN_LAT",
      "name": "DIGIPIN_LAT",
      "description": "Decode a DIGIPIN code to its latitude (cell centre).",
      "result": { "type": "number" },
      "parameters": [
        { "name": "code", "description": "DIGIPIN code (with or without dashes)", "type": "string" }
      ]
    },
    {
      "id": "DIGIPIN_LNG",
      "name": "DIGIPIN_LNG",
      "description": "Decode a DIGIPIN code to its longitude (cell centre).",
      "result": { "type": "number" },
      "parameters": [
        { "name": "code", "description": "DIGIPIN code (with or without dashes)", "type": "string" }
      ]
    },
    {
      "id": "PLUSCODE",
      "name": "PLUSCODE",
      "description": "Encode lat/lng to a Plus Code / Open Location Code (works globally).",
      "helpUrl": "https://maps.google.com/pluscodes/",
      "result": { "type": "string" },
      "parameters": [
        { "name": "lat", "description": "Latitude (-90 to 90)", "type": "number" },
        { "name": "lng", "description": "Longitude (-180 to 180)", "type": "number" },
        { "name": "length", "description": "Code length 4, 6, 8, 10, 11 or 12 (default 10 ≈ 14m × 14m)", "type": "number", "optional": true }
      ]
    },
    {
      "id": "GEOHASH",
      "name": "GEOHASH",
      "description": "Encode lat/lng to a GeoHash (works globally).",
      "result": { "type": "string" },
      "parameters": [
        { "name": "lat", "description": "Latitude (-90 to 90)", "type": "number" },
        { "name": "lng", "description": "Longitude (-180 to 180)", "type": "number" },
        { "name": "length", "description": "Code length 1-12 (default 9 ≈ 5m × 5m)", "type": "number", "optional": true }
      ]
    },
    {
      "id": "RECODE",
      "name": "RECODE",
      "description": "Convert a code from one grid system to another via lat/long pivot.",
      "result": { "type": "string" },
      "parameters": [
        { "name": "code", "description": "Source code", "type": "string" },
        { "name": "from_system", "description": "digipin | pluscode | geohash", "type": "string" },
        { "name": "to_system", "description": "digipin | pluscode | geohash", "type": "string" },
        { "name": "precision", "description": "Optional target precision/length", "type": "number", "optional": true }
      ]
    },
    {
      "id": "CHECKSUM",
      "name": "CHECKSUM",
      "description": "Append a Luhn-mod-16 checksum digit to a DIGIPIN (catches typos).",
      "result": { "type": "string" },
      "parameters": [
        { "name": "code", "description": "DIGIPIN code", "type": "string" }
      ]
    },
    {
      "id": "VERIFY",
      "name": "VERIFY",
      "description": "Verify a DIGIPIN code's trailing checksum digit.",
      "result": { "type": "boolean" },
      "parameters": [
        { "name": "code_with_checksum", "description": "DIGIPIN code with -X checksum suffix", "type": "string" }
      ]
    },
    {
      "id": "DISTANCE",
      "name": "DISTANCE",
      "description": "Distance in metres between the centres of two cells. Systems can differ.",
      "result": { "type": "number" },
      "parameters": [
        { "name": "codeA", "description": "First code", "type": "string" },
        { "name": "codeB", "description": "Second code", "type": "string" },
        { "name": "systemA", "description": "digipin | pluscode | geohash", "type": "string" },
        { "name": "systemB", "description": "digipin | pluscode | geohash", "type": "string" }
      ]
    }
  ]
}
