# generated by datamodel-codegen:
#   filename:  interceptors-config.spec.json

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict, Optional


@dataclass
class InterceptorDefinition:
    priority: int
    config: Dict[str, Any]


TargetIdentity = Dict[str, InterceptorDefinition]


@dataclass
class InterceptorContext:
    definition: Optional[InterceptorDefinition] = None
    """
    Override definition for all entities within the context.
    """
    groups: Optional[TargetIdentity] = None
    """
    Override definition to apply to groups within the context.
    """
    usernames: Optional[TargetIdentity] = None
    """
    Override definition to apply to usernames within the context.
    """


@dataclass
class Interceptor:
    """
    Allows to define the same interceptor and its overrides. Global can only be defined once, an
    """

    pluginClass: Optional[str] = None
    """
    The plugin class to use for this interceptor. It has to be unique per name.
    """
    gateway: Optional[InterceptorDefinition] = None
    """
    Global interceptor definition
    """
    passthrough: Optional[InterceptorContext] = None
    """
    Interceptor override for GW passthrough.
    """
    vclusters: Optional[Dict[str, InterceptorContext]] = None
    """
    Configuration override for vClusters
    """


@dataclass
class GwInterceptorsConfig:
    """
    Specification for GW Interceptors config file
    """

    interceptors: Optional[Dict[str, Interceptor]] = None
