"""Splashscreen specific rules customization."""
from typing import AbstractSet, Iterator, Mapping

from defence360agent.utils.validate import IPVersion

from .types_ import FirewallRule, WebshieldRuleBuilder


class SplashscreenRuleBuilder(WebshieldRuleBuilder):
    """Implement steps specific to generating splashscreen related
    iptables rules.

    """

    def open_webshield_ports_for_localhost_rules(
        self,
        ip_version: IPVersion,
    ) -> Iterator[FirewallRule]:
        """Already added in .captcha"""
        yield from ()

    def block_webshield_ports_rules(
        self, redirect_map: Mapping[int, int], dest_ports: AbstractSet
    ) -> Iterator[FirewallRule]:
        """Already added in .captcha"""
        yield from ()

    def redirect_panel_ports(
        self, ip_version: IPVersion
    ) -> Iterator[FirewallRule]:
        yield from ()

    def logdrop_chain_rules(self, ipset_name: str) -> Iterator[FirewallRule]:
        """Empty generator, we don't want to block for splashscreen"""
        yield from ()

    def drop_tproxy_rules(self, ipset_name: str) -> Iterator[FirewallRule]:
        """Empty generator, we don't want to block for splashscreen"""
        yield from ()
