# Copyright 2025 LY Flava
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from lib.services.langfuse.base_client import BaseLangfuseClient


class LangfuseAdminClient(BaseLangfuseClient):
    """Client for Langfuse Admin operations"""

    def __init__(self, auth_provider, client, **kwargs):
        super(LangfuseAdminClient, self).__init__(
            auth_provider=auth_provider, **kwargs)
        self.client = client  # Injected cloud-specific client

    def list_all_langfuse_projects(self, **kwargs):
        """List all Langfuse projects across all Flava projects (admin only).

        Args:
            **kwargs: Query parameters (projectName, name, createdAtFrom, etc.)

        Returns:
            Response containing list of all Langfuse projects
        """
        return self.client.list_all_langfuse_projects(**kwargs)

    def list_langfuse_projects_by_project(self, project_name, **kwargs):
        """List Langfuse projects for a specific Flava project (admin only).

        Args:
            project_name: Flava project name
            **kwargs: Query parameters (name, createdAtFrom, etc.)

        Returns:
            Response containing list of Langfuse projects for the project
        """
        return self.client.list_langfuse_projects_by_project(project_name, **kwargs)

    def show_langfuse_project_admin(self, project_name, langfuse_project_id):
        """Get details of a Langfuse project (admin only).

        Args:
            project_name: Flava project name
            langfuse_project_id: ID of the Langfuse project

        Returns:
            Response containing detailed Langfuse project information
        """
        return self.client.show_langfuse_project_admin(project_name, langfuse_project_id)

    def list_langfuse_project_users(self, project_name, langfuse_project_id):
        """List users of a Langfuse project (admin only).

        Args:
            project_name: Flava project name
            langfuse_project_id: ID of the Langfuse project

        Returns:
            Response containing list of users
        """
        return self.client.list_langfuse_project_users(project_name, langfuse_project_id)