Design two ads-platform components.
Part A: Frequency capping service. Build a service used during ad decisioning to prevent a user from seeing an ad entity too many times. A cap may apply at the creative, line item, campaign, advertiser, or global level. Example: at most N impressions for a user within a fixed or rolling time window. The service must support low-latency eligibility checks, exposure recording after an impression is served, high write volume, duplicate event handling, cap configuration changes, and privacy-safe user identifiers.
Part B: Direct-sold demand-side order tracking model. Design the data model and tracking flow for a demand-side advertising platform to manage and report on a direct-sold order. Include the order, line items, creatives, budgets, pacing, targeting, frequency caps, inventory or placement configuration, delivery events, and reporting aggregates. The order type is direct-sold demand, so do not model open auction bidding as the core workflow.