"""
AutobahnWarningTag automatically generated by SDKgen please do not edit this file manually
https://sdkgen.app
"""

import requests
import sdkgen
from requests import RequestException
from typing import List

from .autobahn_warning_collection import AutobahnWarningCollection
from .response_exception import ResponseException

class AutobahnWarningTag(sdkgen.TagAbstract):
    def __init__(self, http_client: requests.Session, parser: sdkgen.Parser):
        super().__init__(http_client, parser)


    def get_all(self, autobahn_id: str) -> AutobahnWarningCollection:
        """
        Returns available warnings for a specific autobahn
        """
        try:
            path_params = {}
            path_params["autobahn_id"] = autobahn_id

            query_params = {}

            query_struct_names = []

            url = self.parser.url("/autobahn/:autobahn_id/warning", path_params)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=self.parser.query(query_params, query_struct_names))

            if response.status_code >= 200 and response.status_code < 300:
                return AutobahnWarningCollection.model_validate_json(json_data=response.content)

            if response.status_code == 400:
                raise ResponseException(response.content)
            if response.status_code == 404:
                raise ResponseException(response.content)
            if response.status_code == 500:
                raise ResponseException(response.content)

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except RequestException as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))


