# Wrap a library.
#
# Author: Malte J. Ziebarth (malte.ziebarth@tum.de)
#
# Copyright (C) 2026 Technische Universität München
#
# Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
# the European Commission - subsequent versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at:
#
# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Licence is distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the Licence for the specific language governing permissions and
# limitations under the Licence.
#
# SPDX-FileCopyrightText: 2026 Technical University of Munich
# SPDX-License-Identifier: EUPL-1.2
# SPDX-FileContributor: Malte J. Ziebarth <malte.ziebarth@tum.de>

from ..parse.library import Library
from ..repo.paths import IncludePath
from ..language.abstract import Struct
from ..language.python import CTypeType
from .function import FunctionWrapper

class WrappedLibrary:
    """
    Wrap a parsed library.
    """
    library: Library
    functions: list[FunctionWrapper]

    def __init__(self, library: Library):
        self.library = library
        self.functions = [
            FunctionWrapper(f) for f in library.functions
        ]


    def wrapper_include(self) -> IncludePath:
        return self.library.wrapper_include()

    def header_include(self) -> IncludePath:
        return self.library.header_include()

    def module(self) -> tuple[str, ...]:
        return self.library.module

    def authors(self) -> list[tuple[str, str | None]]:
        return self.library.authors

    def copyright(self) -> list[str]:
        return self.library.copyright

    def license_boilerplate(self) -> str | None:
        return self.library.license_boilerplate

    def shared_library_name(self) -> str:
        return self.library.shared_library_name()

    def requires_numpy(self) -> bool:
        return self.library.requires_numpy()

    def structs(self) -> list[Struct[CTypeType]]:
        return self.library.structs