"""A module that returns the customers available in :term:`GSO`.

For the time being, it's hardcoded to only contain GÉANT as a customer, since this is needed for the deployment of phase
1.
"""

from typing import Any


class CustomerNotFoundError(Exception):
    """Exception raised when a customer is not found."""


def all_customers() -> list[dict]:
    """Hardcoded list of customers available in :term:`GSO`."""
    return [
        {
            "id": "8f0df561-ce9d-4d9c-89a8-7953d3ffc961",
            "name": "GÉANT",
        },
    ]


def get_customer_by_name(name: str) -> dict[str, Any]:
    """Try to get a customer by their name."""
    for customer in all_customers():
        if customer["name"] == name:
            return customer

    msg = f"Customer {name} not found"
    raise CustomerNotFoundError(msg)