{
  "swagger": "2.0",
  "info": {
    "title": "Zetaleap Power Toolkit",
    "description": "Essential missing actions for Microsoft Power Automate Cloud Flows: RegEx extraction, RFC-4180 CSV-to-JSON parsing, Teams Adaptive Card v1.5 builder, Null-safe Parse JSON schema generator, Copilot PII masking, and SLA business days.",
    "version": "1.0.0",
    "contact": {
      "name": "Zetaleap Support Team",
      "url": "https://zetaleap.com/#contact",
      "email": "support_team@zetaleap.com"
    }
  },
  "x-ms-connector-metadata": [
    {
      "propertyName": "Website",
      "propertyValue": "https://zetaleap.com"
    },
    {
      "propertyName": "Privacy policy",
      "propertyValue": "https://zetaleap.com/privacy"
    },
    {
      "propertyName": "Categories",
      "propertyValue": "Productivity;IT Operations"
    }
  ],
  "host": "test.zetaleap.com",
  "basePath": "/",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "api_key": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Enter your Zetaleap Personal Access Token prefixed with Bearer (example: Bearer zl_your_api_token). Generate tokens free at https://zetaleap.com/profile."
    }
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "paths": {
    "/api/pp/regex": {
      "post": {
        "operationId": "RegexMatchExtract",
        "summary": "Match extract or replace text with Regular Expressions",
        "description": "Executes bounded Regular Expression matching, named group extraction, or replacement in Power Automate.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "text",
                "pattern"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "x-ms-summary": "Source Text"
                },
                "pattern": {
                  "type": "string",
                  "x-ms-summary": "RegEx Pattern"
                },
                "flags": {
                  "type": "string",
                  "default": "gi",
                  "x-ms-summary": "RegEx Flags"
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "extract",
                    "replace",
                    "split"
                  ],
                  "default": "extract",
                  "x-ms-summary": "Mode"
                },
                "replacement": {
                  "type": "string",
                  "x-ms-summary": "Replacement Text"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Regex evaluation result",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "isMatch": {
                  "type": "boolean",
                  "x-ms-summary": "Is Match"
                },
                "matchCount": {
                  "type": "integer",
                  "x-ms-summary": "Match Count"
                },
                "firstMatch": {
                  "type": "string",
                  "x-ms-summary": "First Match"
                },
                "matches": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "x-ms-summary": "All Matches"
                },
                "replacedText": {
                  "type": "string",
                  "x-ms-summary": "Replaced Text"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/csv-to-json": {
      "post": {
        "operationId": "ParseCsvToJson",
        "summary": "Parse CSV string into typed JSON array",
        "description": "Parses comma, semicolon, tab, or pipe CSV content into structured JSON rows ready for Apply to each.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "csv"
              ],
              "properties": {
                "csv": {
                  "type": "string",
                  "x-ms-summary": "Raw CSV Content"
                },
                "delimiter": {
                  "type": "string",
                  "default": "auto",
                  "x-ms-summary": "Delimiter (auto , ; |)"
                },
                "normalizeHeaders": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Normalize Headers"
                },
                "autoType": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Auto Cast Numbers and Booleans"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Parsed CSV rows",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "delimiterUsed": {
                  "type": "string",
                  "x-ms-summary": "Detected Delimiter"
                },
                "rowCount": {
                  "type": "integer",
                  "x-ms-summary": "Row Count"
                },
                "headers": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "x-ms-summary": "Column Headers"
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  },
                  "x-ms-summary": "Parsed JSON Rows"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/adaptive-card": {
      "post": {
        "operationId": "BuildTeamsAdaptiveCard",
        "summary": "Build Microsoft Teams Adaptive Card v1.5 JSON",
        "description": "Generates a valid Microsoft Teams Adaptive Card v1.5 JSON payload for approvals, KPIs, and alerts.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "title",
                "summary"
              ],
              "properties": {
                "template": {
                  "type": "string",
                  "enum": [
                    "approval",
                    "kpi",
                    "incident",
                    "copilot"
                  ],
                  "default": "approval",
                  "x-ms-summary": "Card Template"
                },
                "title": {
                  "type": "string",
                  "x-ms-summary": "Card Title"
                },
                "summary": {
                  "type": "string",
                  "x-ms-summary": "Summary Body"
                },
                "metricValue": {
                  "type": "string",
                  "x-ms-summary": "Highlight Metric"
                },
                "metricDelta": {
                  "type": "string",
                  "x-ms-summary": "Metric Delta"
                },
                "primaryActionTitle": {
                  "type": "string",
                  "x-ms-summary": "Action Button Label"
                },
                "primaryActionUrl": {
                  "type": "string",
                  "x-ms-summary": "Action Button URL"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated Adaptive Card payload",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "schemaVersion": {
                  "type": "string",
                  "x-ms-summary": "Adaptive Card Version"
                },
                "cardJsonString": {
                  "type": "string",
                  "x-ms-summary": "Adaptive Card JSON String"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/json-schema": {
      "post": {
        "operationId": "GenerateParseJsonSchema",
        "summary": "Generate null-safe Parse JSON schema from sample payload",
        "description": "Infers a crash-proof nullable JSON schema from any sample payload for Power Automate Parse JSON.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "sample"
              ],
              "properties": {
                "sample": {
                  "type": "object",
                  "x-ms-summary": "Sample JSON Object"
                },
                "nullSafe": {
                  "type": "boolean",
                  "default": true,
                  "x-ms-summary": "Allow Null Values"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Generated Parse JSON schema",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "schemaString": {
                  "type": "string",
                  "x-ms-summary": "Parse JSON Schema String"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/mask-pii": {
      "post": {
        "operationId": "MaskSensitivePii",
        "summary": "Redact emails IBANs cards and phones before AI prompts",
        "description": "Masks sensitive PII tokens in unstructured text prior to Copilot Studio or OpenAI prompts.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "text"
              ],
              "properties": {
                "text": {
                  "type": "string",
                  "x-ms-summary": "Input Text"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Redacted text result",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "maskedText": {
                  "type": "string",
                  "x-ms-summary": "Masked Safe Text"
                },
                "redactionCount": {
                  "type": "integer",
                  "x-ms-summary": "Redaction Count"
                }
              }
            }
          }
        }
      }
    },
    "/api/pp/business-days": {
      "post": {
        "operationId": "CalculateBusinessDays",
        "summary": "Calculate SLA business days excluding weekends and holidays",
        "description": "Adds business days or calculates working day difference using regional holiday calendars.",
        "x-ms-visibility": "important",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "required": [
                "startDate"
              ],
              "properties": {
                "startDate": {
                  "type": "string",
                  "x-ms-summary": "Start Date (YYYY-MM-DD)"
                },
                "daysToAdd": {
                  "type": "integer",
                  "default": 5,
                  "x-ms-summary": "Business Days to Add"
                },
                "country": {
                  "type": "string",
                  "default": "US",
                  "x-ms-summary": "Holiday Country (US UK EU DE TR)"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SLA calculation response",
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean",
                  "x-ms-summary": "Success"
                },
                "resultDate": {
                  "type": "string",
                  "x-ms-summary": "Target Business Date"
                },
                "businessDays": {
                  "type": "integer",
                  "x-ms-summary": "Business Days"
                },
                "weekendDaysSkipped": {
                  "type": "integer",
                  "x-ms-summary": "Weekends Skipped"
                }
              }
            }
          }
        }
      }
    }
  }
}