<?php

namespace App\Services\Traefik;

interface TraefikWriter
{
    /**
     * Write a file-provider router on the Traefik host ($trafficHost) that
     * routes every hostname in $hostnames to the guest ($backend).
     *
     * A LIST, not one name: an instance is reachable under its platform
     * address always, and under the customer's verified domain as well when
     * there is one. They belong in ONE router under one name — the subdomain,
     * which is stable and is what remove() deletes — because two routers for
     * one backend are two things to keep in step, and the second one is what
     * gets forgotten the day the domain is withdrawn.
     *
     * @param  array<int, string>  $hostnames  platform address first
     */
    public function write(string $trafficHost, string $subdomain, array $hostnames, string $backend): void;

    public function remove(string $trafficHost, string $subdomain): void;

    /** True once the ACME (HTTP-01) certificate for the fqdn is served. */
    public function certReachable(string $fqdn): bool;
}
