"""EVPIN-01 rollout: Analytics-only, using existing ct CAS and drain guards."""
import sys

from artifact_install import ArtifactInstaller


class EventPinInstaller(ArtifactInstaller):
    def prepare(self):
        if set(self.m['after']) != {'app/event_capture.py', 'app/protected_packet_cache.py'}:
            raise ValueError('EVENT_PIN_PAYLOAD_SCOPE')
        super().prepare()
        # The inherited activation requires this marker; no schema/index mutation.
        self.save('indexes', dict(schemaUnchanged=True, migrationRequired=False))


if __name__ == '__main__':
    root, expected, action = sys.argv[1:]
    if action not in ('prepare', 'build', 'activate', 'finish_activation', 'verify'):
        raise ValueError('UNSUPPORTED_ACTION')
    getattr(EventPinInstaller(root, expected), action)()
