<?php

namespace App\Campaigns\Manager;

/**
 * Everything one read of a campaign returned, and what it could not cover.
 *
 * Completeness is tracked per entity type because reads fail unevenly: a
 * LinkedIn campaign and its group can be read whole while its creatives stop at
 * a page limit. Only types read in full may have missing rows treated as
 * removed; anything else would report a deletion that never happened.
 */
final readonly class PlatformSnapshot
{
    /**
     * @param  list<PlatformEntity>  $entities
     * @param  list<string>  $incompleteTypes  entity types not read in full
     * @param  list<string>  $gaps  plain-language reasons, for the person reading
     */
    public function __construct(
        public array $entities,
        public array $incompleteTypes = [],
        public array $gaps = [],
    ) {}

    public function complete(): bool
    {
        return $this->incompleteTypes === [];
    }

    public function covers(string $type): bool
    {
        return ! in_array($type, $this->incompleteTypes, true);
    }
}
