# Ads Manager Service Architecture

## Overview

```mermaid
graph TB
    subgraph "ads-manager-service"
        API[API Layer]
        APP[Application Layer]
        DOM[Domain Layer]
        INF[Infrastructure Layer]
    end
    
    API --> APP
    APP --> DOM
    APP --> INF
    INF --> DOM
    
    subgraph "External"
        IAM[IAM Service]
        STOR[Storage Service]
        BILL[ads-billing]
        SERVE[ads-serving]
        MQ[RabbitMQ]
    end
    
    API --> IAM
    API --> STOR
    INF --> MQ
    MQ --> BILL
    MQ --> SERVE
```

## Domain Aggregates

### Campaign Aggregate
- **Campaign** (Root): Objectives, status, budget
- **CampaignObjective**: Awareness, Traffic, Conversion
- **CampaignBudget**: Daily/Lifetime, Amount

### AdSet Aggregate
- **AdSet** (Root): Ad group
- **Targeting**: Core/Interest/Custom/Lookalike
- **Placement**: Feed, Story, Search
- **BidStrategy**: CPC, CPM, OCPM

### Ad Aggregate  
- **Ad** (Root): Ad creative
- **AdCreative**: Media, Headline, CTA
- **AdReviewStatus**: Pending/Approved/Rejected

### Audience Aggregate
- **CustomAudience**: Uploaded lists
- **LookalikeAudience**: Similar users

## Data Flow

```
Create Campaign → Validate → Save → Publish Event → ads-serving syncs
```
