<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Campaign Manager
    |--------------------------------------------------------------------------
    |
    | The manager keeps a read-only picture of each published campaign as its
    | platform reports it, so changes made in Ads Manager, the Google Ads UI or
    | LinkedIn Campaign Manager are visible here before anyone edits from here.
    |
    */

    // Commit rollout changes here: Meta first, then LinkedIn, then Google.
    // These platform lists deliberately do not read environment overrides.
    'visible_platforms' => ['meta'],

    // Older than this, a snapshot is shown as stale and refreshed when opened.
    'stale_after_minutes' => (int) env('CAMPAIGN_MANAGER_STALE_AFTER_MINUTES', 60),

    // Manual refreshes one person may start per campaign per minute.
    'refreshes_per_minute' => (int) env('CAMPAIGN_MANAGER_REFRESHES_PER_MINUTE', 4),

    // Background reconciliation of managed campaigns. Off until the read load
    // on each platform has been looked at.
    'schedule_sync' => (bool) env('CAMPAIGN_MANAGER_SCHEDULE_SYNC', false),

    // Most campaigns one scheduled pass reads.
    'sync_batch_size' => (int) env('CAMPAIGN_MANAGER_SYNC_BATCH_SIZE', 25),

    // Platforms the manager may change: meta, linkedin, google.
    // Empty means read-only everywhere. A platform is added here only after
    // its edits have been tried against a test account.
    'edit_platforms' => ['meta'],

    // Kinds of change allowed on those platforms, comma separated:
    // name,status,budget,bid,bid_strategy,optimization,spend,frequency,targeting,
    // schedule,duplicate,delete.
    // Budgets and bids change what is spent,
    // so they are switched on separately once names have been running cleanly;
    // an end date re-paces a total budget, so schedule follows the same way.
    // status starts and stops delivery, and archives. duplicate makes paused
    // Meta/Google copies or reconstructs LinkedIn campaigns/creatives as DRAFT;
    // delete removes objects for good,
    // after their lifetime spend has been shown and acknowledged. bid_strategy
    // switches how the platform bids (and Google's CPA and ROAS targets),
    // which sends delivery back into learning. optimization controls Meta
    // conversion-event copies and LinkedIn campaign conversion associations.
    // Meta's published optimization goal and event remain immutable in place.
    // A Google campaign's run dates are part of schedule. spend sets Meta's
    // campaign spending limit and an ad set's share of a campaign budget;
    // frequency caps how often one person sees an eligible Meta, Google or
    // LinkedIn Brand Awareness campaign's ads. targeting
    // changes Meta audiences, geography, placement positions and devices,
    // Google's native campaign/ad-group criteria and LinkedIn's AND/OR
    // targeting and native Audience Network delivery. Advanced controls validate native JSON shapes; they do not
    // accept arbitrary API fields. schedule also covers delivery windows,
    // budget includes Meta budget boosts, and bid_strategy includes pacing
    // and eligible Meta ROAS floors.
    'edit_categories' => array_values(array_filter(array_map('trim', explode(',', (string) env('CAMPAIGN_MANAGER_EDIT_CATEGORIES', 'name'))))),

    // A budget or bid moving by more than this percentage has to be
    // acknowledged before it is sent: large swings reset delivery learning.
    'confirm_change_percent' => (float) env('CAMPAIGN_MANAGER_CONFIRM_CHANGE_PERCENT', 20),

];
