<?php

namespace LakeDrops\Docker4Drupal;

use LakeDrops\Component\Composer\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class TraefikRewriteCommand extends BaseCommand {

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this->setName('lakedrops:traefik:rewrite');
    $this->setDescription('Rewrite Traefik config on this host.');
  }

  /**
   * {@inheritdoc}
   */
  public function getHandlerClass(): string {
    return Handler::class;
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output): int {
    parent::execute($input, $output);
    /** @var Handler $handler */
    $handler = $this->handler;
    $handler->configureTraefik();
    return 0;
  }

}