# Field Reference

[Advertiser](#advertiser)
[Campaign](#campaign)
[Ad](#ad)
[Zone](#zone)
[ZoneAssignment](#zone-assignment)

## Advertiser

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | AutoField | – | Auto-generated primary key. |
| `name` | CharField(200) | Yes | Full name of the advertiser. Shown in all listings. |
| `email` | EmailField | No | Contact email for reports and invoices. |
| `is_active` | BooleanField | Default: true | Inactive advertisers are hidden in filters. Their campaigns are not served. |
| `created_at` | DateTimeField | Auto | Creation timestamp (set automatically). |

## Campaign

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `advertiser` | FK → Advertiser | Yes | Associated advertiser. ON DELETE CASCADE. |
| `name` | CharField(200) | Yes | Campaign name. |
| `campaign_type` | CharField Choices | Yes | budget / impression / fixed. |
| `is_active` | BooleanField | Default: true | Manual on/off switch. |
| `start_date` | DateField | No | Valid from this date (inclusive). |
| `end_date` | DateField | No | Valid until this date (inclusive). |
| `cpm` | DecimalField(10,4) | Budget type | Price per 1,000 impressions in EUR. |
| `total_budget` | DecimalField(12,2) | No | Maximum total budget in EUR. |
| `daily_budget` | DecimalField(12,2) | No | Maximum daily budget in EUR. |
| `max_impressions` | BigIntegerField | Impression type | Impression limit before the campaign stops. |
| `pacing_enabled` | BooleanField | Default: false | Enables even budget distribution. |
| `smart_pacing_enabled` | BooleanField | Default: false | Enables CTR-based Smart Boost. |
| `smart_pacing_boost_percent` | IntegerField | Default: 150 | Max. delivery as % of hourly target during boost. |
| `smart_pacing_min_ctr` | DecimalField(5,2) | Default: 0.5 | Min. CTR (%) for boost to activate. |

## Ad

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `campaign` | FK → Campaign | Yes | Associated campaign. |
| `name` | CharField(200) | Yes | Ad name for internal identification. |
| `ad_type` | CharField Choices | Yes | image or html. |
| `image` | ImageField | Image type | Image file. Stored in MEDIA\_ROOT. |
| `click_url` | URLField | Image type | Destination URL on click. |
| `alt_text` | CharField(200) | No | Image alt attribute. |
| `html_content` | TextField | HTML type | HTML source code of the ad. |
| `width / height` | PositiveIntegerField | No | Dimensions in pixels. |
| `weight` | PositiveIntegerField | Default: 1 | Rotation weight. Min. 1. |
| `is_active` | BooleanField | Default: true | Inactive ads are not served. |

## Zone

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | CharField(200) | Yes | Internal name of the zone (e.g. "Header Banner"). |
| `description` | TextField | No | Optional description. |
| `width / height` | PositiveIntegerField | Yes | Dimensions of the ad slot in pixels. |
| `max_impressions_per_session` | PositiveIntegerField | Default: 0 | Session cap. 0 = unlimited. Requires consent cookie. |
| `fallback_html` | TextField | No | HTML5 shown when zone is active but has no running ad. |
| `is_active` | BooleanField | Default: true | Inactive zones serve no ad. |

## ZoneAssignment

Links a campaign to a zone. The model has a unique constraint on `(zone, campaign)`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `zone` | FK → Zone | Yes | Target zone for this assignment. |
| `campaign` | FK → Campaign | Yes | Assigned campaign. |
| `priority` | PositiveIntegerField | Default: 1 | Delivery priority (1–10). Higher = preferred. |
