# assets/example-business.json

This file is part of the skill, at `assets/example-business.json` relative to the skill's directory. Write the code below to that path in the user's project before running or copying it.

```json
{
  "name": "Demo",
  "object_title": "Demo Business",
  "description": "A business that has seats, with business-level state stored once",
  "key_field": "business_id",
  "required": [
    "business_id",
    "business_name",
    "plan",
    "seat_limit",
    "seats_used",
    "seat_utilization_pct"
  ],
  "fields": [
    {
      "name": "business_id",
      "type": "string"
    },
    {
      "name": "business_name",
      "type": "string"
    },
    {
      "name": "plan",
      "type": "string",
      "description": "free, team or enterprise"
    },
    {
      "name": "seat_limit",
      "type": "int"
    },
    {
      "name": "seats_used",
      "type": "int"
    },
    {
      "name": "seat_utilization_pct",
      "type": "int",
      "ratio_of": [
        "seats_used",
        "seat_limit"
      ]
    },
    {
      "name": "sales_contacted_at",
      "type": "timestamp",
      "description": "When Sales last contacted this business"
    },
    {
      "name": "lead_acquired_at",
      "type": "timestamp"
    }
  ],
  "business_profile": {
    "properties": {}
  },
  "seat_defaults": {},
  "seat_properties": [
    {
      "name": "role",
      "type": "string",
      "allowed": [
        "admin",
        "member"
      ]
    }
  ],
  "events": [
    {
      "name": "lead_acquired",
      "level": "seat",
      "properties": [
        "business_name",
        "source"
      ]
    },
    {
      "name": "sales_contacted",
      "level": "business",
      "properties": [
        "business_name",
        "rep"
      ]
    },
    {
      "name": "ide_installed",
      "level": "seat",
      "properties": [
        "business_name"
      ]
    },
    {
      "name": "agent_run_completed",
      "level": "seat",
      "properties": [
        "business_name",
        "credits_spent"
      ]
    },
    {
      "name": "paywall_hit",
      "level": "seat",
      "properties": [
        "business_name",
        "plan"
      ]
    }
  ],
  "scenarios": [
    {
      "description": "Do not message seats at a business that Sales contacted in the last 3 days",
      "uses_fields": [
        "sales_contacted_at"
      ]
    },
    {
      "description": "Email only seats whose business is at 90% or more of its seats",
      "uses_fields": [
        "seat_utilization_pct"
      ]
    }
  ],
  "businesses": [
    {
      "values": {
        "business_id": "biz_example_teamworks",
        "business_name": "Example Teamworks",
        "plan": "team",
        "seat_limit": 10,
        "seats_used": 9,
        "seat_utilization_pct": 90,
        "sales_contacted_at": "2026-10-18T15:00:00Z",
        "lead_acquired_at": "2026-08-02T12:00:00Z"
      },
      "seats": [
        {
          "email": "alex@example.com",
          "properties": {
            "role": "admin"
          }
        },
        {
          "email": "sam@example.com",
          "properties": {
            "role": "member"
          }
        },
        {
          "email": "jo@example.com",
          "properties": {
            "role": "member"
          }
        }
      ]
    },
    {
      "values": {
        "business_id": "biz_example_analytics",
        "business_name": "Example Analytics",
        "plan": "free",
        "seat_limit": 3,
        "seats_used": 2,
        "seat_utilization_pct": 67,
        "lead_acquired_at": "2026-10-01T09:00:00Z"
      },
      "seats": [
        {
          "email": "pat@example.com",
          "properties": {
            "role": "admin"
          }
        },
        {
          "email": "kim@example.com",
          "properties": {
            "role": "member"
          }
        }
      ]
    }
  ],
  "detectors": [
    {
      "name": "seat_limit_reached",
      "description": "seat limit reached",
      "kind": "state",
      "audience": "business",
      "when": {
        "field": "seat_utilization_pct",
        "op": ">=",
        "value": 100
      },
      "then": {
        "type": "internal_alert",
        "to": [
          "team@example.com"
        ]
      }
    },
    {
      "name": "seats_nearly_full",
      "description": "admins of nearly full businesses",
      "kind": "state",
      "audience": "seat",
      "who": {
        "role": "admin"
      },
      "when": {
        "field": "seat_utilization_pct",
        "op": ">=",
        "value": 90
      },
      "unless": {
        "field": "sales_contacted_at",
        "within_days": 3
      },
      "reentry_days": 14,
      "then": {
        "type": "email",
        "from_email": "team@example.com",
        "subject": "Your team is almost out of seats"
      }
    },
    {
      "name": "welcome_after_install",
      "description": "welcome after install",
      "kind": "event",
      "audience": "seat",
      "on": {
        "event": "ide_installed"
      },
      "delay": {
        "value": 1,
        "unit": "hours"
      },
      "then": {
        "type": "email",
        "from_email": "team@example.com",
        "subject": "Welcome"
      }
    }
  ],
  "subscribe_sample_seats": true
}
```
