# Database Schema

## Main Tables
- users
- roles
- permissions
- role_permissions
- contacts
- tags
- contact_tags
- senders
- templates
- drafts
- campaigns
- campaign_recipients
- conversations
- messages
- webhook_events
- integration_configs
- activity_logs
- jobs

## Key Notes
- Use UUID primary keys
- Store raw provider payloads in JSONB
- Normalize webhook events into internal event types
- Use created_at and updated_at on all mutable entities
- Track message lifecycle timestamps: sent, delivered, read, failed

## Suggested Enums
### User Status
- active
- inactive
- suspended

### Template Status
- draft
- pending
- approved
- rejected
- archived

### Campaign Status
- draft
- scheduled
- processing
- completed
- paused
- failed
- cancelled

### Message Status
- queued
- sent
- delivered
- read
- failed
