# Ads Platform — User Flows

All flows use **one login** (phone + password). No separate advertiser registration site.

---

## Flow A: User registers business profile (to post ads)

```
Already logged in as Aihub member
    → Hubs → Ads
    → Tab: "Post an Ad"
    → No profile yet → inline form:
        • Type: Individual | Company
        • Display name / company name
        • Category (retail, services, …)
        • Optional company reg #
    → Submit → ad_profiles.status = pending
    → Admin → Ads → Profiles → Approve
    → User gets notify: "Your business profile is approved"
    → Post tab unlocks campaign creator
```

Same user can still use Watch tab if they also subscribe.

---

## Flow B: User subscribes to watch and earn

```
Logged in → Hubs → Ads
    → Tab: "Watch & Earn"
    → Locked overlay: "Subscribe to an Ads plan"
    → uGo('subs') → pick Ads Weekly / Monthly
    → Pay from investment balance (existing subscribe API)
    → Return to Ads hub → Watch tab shows ad feed
```

---

## Flow C: User watches poster ad and earns

```
Ads hub → Watch & Earn tab (subscription active)
    → Grid of active campaigns (thumb, reward, type)
    → Tap ad → fullscreen poster + countdown
    → POST api/ads.php?action=complete
    → Wallet credited, toast shown
    → Campaign budget reduced
```

---

## Flow D: User watches video ad and earns

```
Watch tab → video card → player
    → Progress tracked
    → At min % / seconds → claim reward
    → Same complete API as image flow
```

---

## Flow E: Same user funds and posts a campaign

```
Ads hub → Post an Ad tab (profile approved)
    → "Create campaign"
    → Upload image or video, title, link, budget amount
    → System checks users.balance >= budget
    → Debit balance → campaign budget_total set
    → Status: pending → admin approve → active in Watch feed
```

**My Campaigns tab:** list own campaigns, spend, views, pause (future).

---

## Flow F: Admin moderates (existing admin app)

```
Admin login (unchanged)
    → Sidebar: Ads
    ├── Dashboard
    ├── Business profiles (approve/reject)
    ├── Campaigns (approve/reject/pause)
    └── Settings (CPV, fees, caps)
```

---

## State diagrams

### Ad profile (`ad_profiles`)
`none` → `pending` → `approved` | `rejected` | `suspended`

### Campaign (`ad_campaigns`)
`draft` → `pending` → `active` → `paused` | `ended` | `rejected`

### View session (`ad_views`)
`started` → `completed` | `rejected`

### Watch access
`user_subscriptions` active for `plan_type = 'ads'`

---

## Same user, both roles (example)

1. **Jane** signs up as normal member.  
2. Subscribes to Ads Monthly → watches ads, earns UGX 2,000/day.  
3. Jane opens **Post an Ad**, registers “Jane’s Boutique” (company profile).  
4. Admin approves. Jane funds UGX 100,000 from balance, uploads poster.  
5. Admin approves campaign. **Other subscribers** see Jane’s ad in Watch feed and earn when they view it.

Jane does not need a second account.
