{
  "info": {
    "title": "HOA OS",
    "description": "HOA management platform integration",
    "version": "1.0.0"
  },
  "authentication": {
    "type": "api_key",
    "test": {
      "url": "{{base_url}}/api/zapier/auth/test",
      "method": "GET"
    },
    "fields": [
      {
        "key": "api_key",
        "label": "API Key",
        "required": true,
        "type": "password",
        "helpText": "Find your API key in Admin → API Keys"
      }
    ],
    "connectionLabel": "{{name}} ({{subdomain}})"
  },
  "triggers": {
    "new_payment": {
      "key": "new_payment",
      "noun": "Payment",
      "display": {
        "label": "New Payment",
        "description": "Triggers when a new payment is recorded."
      },
      "operation": {
        "type": "polling",
        "url": "{{base_url}}/api/zapier/triggers/new_payment",
        "sample": {
          "id": 1,
          "unit_id": 1,
          "unit_number": "101",
          "amount": 150,
          "payment_method": "credit_card",
          "payment_date": "2024-01-15",
          "owner_name": "John Smith",
          "owner_email": "john@example.com",
          "created_at": "2024-01-15T10:30:00Z"
        }
      }
    },
    "new_violation": {
      "key": "new_violation",
      "noun": "Violation",
      "display": {
        "label": "New Violation",
        "description": "Triggers when a new violation is reported."
      },
      "operation": {
        "type": "polling",
        "url": "{{base_url}}/api/zapier/triggers/new_violation",
        "sample": {
          "id": 1,
          "unit_id": 1,
          "unit_number": "101",
          "type": "noise",
          "description": "Loud music after 10pm",
          "status": "reported",
          "severity": "minor",
          "owner_name": "John Smith",
          "created_at": "2024-01-15T10:30:00Z"
        }
      }
    },
    "new_form": {
      "key": "new_form",
      "noun": "Form Submission",
      "display": {
        "label": "New Form Submission",
        "description": "Triggers when a form is submitted."
      },
      "operation": {
        "type": "polling",
        "url": "{{base_url}}/api/zapier/triggers/new_form",
        "sample": {
          "id": 1,
          "form_type": "maintenance-request",
          "submitter_name": "John Smith",
          "submitter_email": "john@example.com",
          "unit_number": "101",
          "status": "pending",
          "created_at": "2024-01-15T10:30:00Z"
        }
      }
    },
    "payment_overdue": {
      "key": "payment_overdue",
      "noun": "Overdue Payment",
      "display": {
        "label": "Payment Overdue",
        "description": "Triggers when an invoice becomes overdue."
      },
      "operation": {
        "type": "polling",
        "url": "{{base_url}}/api/zapier/triggers/payment_overdue",
        "sample": {
          "id": 1,
          "unit_id": 1,
          "unit_number": "101",
          "amount": 150,
          "due_date": "2024-01-01",
          "days_overdue": 15,
          "owner_name": "John Smith",
          "owner_email": "john@example.com"
        }
      }
    },
    "invoice_created": {
      "key": "invoice_created",
      "noun": "Invoice",
      "display": {
        "label": "New Invoice",
        "description": "Triggers when a new invoice is created."
      },
      "operation": {
        "type": "polling",
        "url": "{{base_url}}/api/zapier/triggers/invoice_created",
        "sample": {
          "id": 1,
          "invoice_number": "INV-2024-001",
          "unit_id": 1,
          "unit_number": "101",
          "amount": 150,
          "due_date": "2024-02-01",
          "type": "assessment",
          "owner_name": "John Smith",
          "created_at": "2024-01-15T10:30:00Z"
        }
      }
    }
  },
  "actions": {
    "create_payment": {
      "key": "create_payment",
      "noun": "Payment",
      "display": {
        "label": "Record Payment",
        "description": "Records a new payment for a unit."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/create_payment",
        "method": "POST",
        "inputFields": [
          {
            "key": "unit_id",
            "label": "Unit ID",
            "type": "integer",
            "required": true
          },
          {
            "key": "amount",
            "label": "Amount",
            "type": "number",
            "required": true
          },
          {
            "key": "payment_method",
            "label": "Payment Method",
            "type": "string",
            "default": "external"
          },
          {
            "key": "payment_date",
            "label": "Payment Date",
            "type": "date"
          },
          {
            "key": "notes",
            "label": "Notes",
            "type": "text"
          },
          {
            "key": "external_id",
            "label": "External Reference",
            "type": "string"
          }
        ],
        "sample": {
          "success": true,
          "payment": {
            "id": 1,
            "unit_id": 1,
            "amount": 150
          }
        }
      }
    },
    "create_announcement": {
      "key": "create_announcement",
      "noun": "Announcement",
      "display": {
        "label": "Create Announcement",
        "description": "Creates a new community announcement."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/create_announcement",
        "method": "POST",
        "inputFields": [
          {
            "key": "title",
            "label": "Title",
            "type": "string",
            "required": true
          },
          {
            "key": "content",
            "label": "Content",
            "type": "text",
            "required": true
          },
          {
            "key": "category",
            "label": "Category",
            "type": "string",
            "choices": [
              "general",
              "maintenance",
              "meeting",
              "policy",
              "emergency"
            ]
          },
          {
            "key": "priority",
            "label": "Priority",
            "type": "string",
            "choices": [
              "low",
              "normal",
              "high",
              "urgent"
            ]
          },
          {
            "key": "publish_date",
            "label": "Publish Date",
            "type": "date"
          }
        ],
        "sample": {
          "success": true,
          "announcement": {
            "id": 1,
            "title": "Pool Maintenance"
          }
        }
      }
    },
    "create_violation": {
      "key": "create_violation",
      "noun": "Violation",
      "display": {
        "label": "Report Violation",
        "description": "Reports a new violation for a unit."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/create_violation",
        "method": "POST",
        "inputFields": [
          {
            "key": "unit_id",
            "label": "Unit ID",
            "type": "integer",
            "required": true
          },
          {
            "key": "violation_type",
            "label": "Violation Type",
            "type": "string",
            "required": true
          },
          {
            "key": "description",
            "label": "Description",
            "type": "text",
            "required": true
          },
          {
            "key": "severity",
            "label": "Severity",
            "type": "string",
            "choices": [
              "minor",
              "moderate",
              "major",
              "critical"
            ]
          }
        ],
        "sample": {
          "success": true,
          "violation": {
            "id": 1,
            "unit_id": 1,
            "type": "noise"
          }
        }
      }
    },
    "send_sms": {
      "key": "send_sms",
      "noun": "SMS",
      "display": {
        "label": "Send SMS",
        "description": "Sends an SMS message to an owner."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/send_sms",
        "method": "POST",
        "inputFields": [
          {
            "key": "owner_id",
            "label": "Owner ID",
            "type": "integer",
            "helpText": "Provide owner_id OR phone"
          },
          {
            "key": "phone",
            "label": "Phone Number",
            "type": "phone"
          },
          {
            "key": "message",
            "label": "Message",
            "type": "text",
            "required": true
          }
        ],
        "sample": {
          "success": true,
          "sms": {
            "sid": "SM123",
            "to": "+15551234567",
            "status": "queued"
          }
        }
      }
    },
    "update_owner": {
      "key": "update_owner",
      "noun": "Owner",
      "display": {
        "label": "Update Owner",
        "description": "Updates owner information."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/update_owner",
        "method": "POST",
        "inputFields": [
          {
            "key": "owner_id",
            "label": "Owner ID",
            "type": "integer",
            "required": true
          },
          {
            "key": "name",
            "label": "Name",
            "type": "string"
          },
          {
            "key": "email",
            "label": "Email",
            "type": "email"
          },
          {
            "key": "phone",
            "label": "Phone",
            "type": "phone"
          },
          {
            "key": "address",
            "label": "Mailing Address",
            "type": "text"
          },
          {
            "key": "is_resident",
            "label": "Is Resident",
            "type": "boolean"
          }
        ],
        "sample": {
          "success": true,
          "owner": {
            "id": 1
          }
        }
      }
    },
    "update_violation_status": {
      "key": "update_violation_status",
      "noun": "Violation",
      "display": {
        "label": "Update Violation Status",
        "description": "Updates the status of a violation."
      },
      "operation": {
        "url": "{{base_url}}/api/zapier/actions/update_violation_status",
        "method": "POST",
        "inputFields": [
          {
            "key": "violation_id",
            "label": "Violation ID",
            "type": "integer",
            "required": true
          },
          {
            "key": "status",
            "label": "Status",
            "type": "string",
            "required": true,
            "choices": [
              "reported",
              "warning_sent",
              "hearing_scheduled",
              "fined",
              "resolved",
              "dismissed"
            ]
          },
          {
            "key": "resolution_notes",
            "label": "Resolution Notes",
            "type": "text"
          }
        ],
        "sample": {
          "success": true,
          "violation": {
            "id": 1,
            "status": "resolved"
          }
        }
      }
    }
  },
  "searches": {
    "find_unit": {
      "key": "find_unit",
      "noun": "Unit",
      "display": {
        "label": "Find Unit",
        "description": "Finds a unit by number."
      },
      "operation": {
        "url": "{{base_url}}/api/v1/units",
        "method": "GET",
        "inputFields": [
          {
            "key": "unit_number",
            "label": "Unit Number",
            "type": "string",
            "required": true
          }
        ]
      }
    },
    "find_owner": {
      "key": "find_owner",
      "noun": "Owner",
      "display": {
        "label": "Find Owner",
        "description": "Finds an owner by email."
      },
      "operation": {
        "url": "{{base_url}}/api/v1/owners",
        "method": "GET",
        "inputFields": [
          {
            "key": "email",
            "label": "Email",
            "type": "email",
            "required": true
          }
        ]
      }
    }
  },
  "base_url": "https://gulfsidevillas.org",
  "scopes": [
    {
      "key": "read:units",
      "description": "Read unit information"
    },
    {
      "key": "read:owners",
      "description": "Read owner information"
    },
    {
      "key": "read:payments",
      "description": "Read payment history"
    },
    {
      "key": "read:invoices",
      "description": "Read invoices"
    },
    {
      "key": "read:violations",
      "description": "Read violations"
    },
    {
      "key": "read:forms",
      "description": "Read form submissions"
    },
    {
      "key": "read:announcements",
      "description": "Read announcements"
    },
    {
      "key": "write:payments",
      "description": "Record payments"
    },
    {
      "key": "write:announcements",
      "description": "Create announcements"
    },
    {
      "key": "write:violations",
      "description": "Create/update violations"
    },
    {
      "key": "write:owners",
      "description": "Update owner information"
    },
    {
      "key": "write:communications",
      "description": "Send SMS/emails"
    }
  ]
}