# !/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@Author: xiaodong.li
@Time: 2025/07/15 15:34
@Description: Description
@File: administrator_service.py
"""
from typing import List

from api_requester.core.admin.api.administrator_api import AdministratorApi
from api_requester.core.admin.dto.administrator import Administrator
from api_requester.core.admin.dto.administrator_query_dto import AdministratorQueryDto
from api_requester.core.admin.dto.change_password_dto import ChangePasswordDto
from api_requester.core.admin.dto.change_user_password import ChangeUserPassword
from api_requester.core.admin.dto.jwt_authentication_request import JwtAuthenticationRequest
from api_requester.core.admin.dto.sso_token_retrieve_dto import SsoTokenRetrieveDto


class AdministratorService(AdministratorApi):
    """
    The AdministratorService was generated by Generator from the AdministratorController.java file.
    """

    def __init__(self):
        AdministratorApi.__init__(self)
    
    def administrator_authentication_token(self, authentication_request: JwtAuthenticationRequest = None):
        return self.administrator_authentication_token_api(json=authentication_request)
    
    def change_administrator_password(self, change_password_dto: ChangePasswordDto = None):
        return self.change_administrator_password_api(json=change_password_dto)
    
    def administrator_list(self, page_no: int = 1, page_size: int = 10, administrator_query_dto: AdministratorQueryDto = None):
        return self.administrator_list_api(params=dict(pageNo=page_no, pageSize=page_size), json=administrator_query_dto)
    
    def create_administrator(self, administrator: Administrator = None):
        return self.create_administrator_api(json=administrator)
    
    def delete_administrator(self, administrator_id: int):
        return self.delete_administrator_api(url_kwargs={'administrator-id': administrator_id})
    
    def update_administrator(self, administrator_id: int, administrator: Administrator = None):
        return self.update_administrator_api(url_kwargs={'administrator-id': administrator_id}, json=administrator)
    
    def update_administrator_password(self, administrator_id: int, change_user_password: ChangeUserPassword = None):
        return self.update_administrator_password_api(url_kwargs={'administrator-id': administrator_id}, json=change_user_password)
    
    def administrator_administrator_id_user_activation(self, administrator_id: int, administrator: Administrator = None):
        return self.administrator_administrator_id_user_activation_api(url_kwargs={'administrator-id': administrator_id}, json=administrator)
    
    def administrator_permission(self):
        return self.administrator_permission_api()
    
    def set_administrator_permission(self, administrator_id: int, permission_id: List[int] = None):
        return self.set_administrator_permission_api(url_kwargs={'administrator-id': administrator_id}, json=permission_id)
    
    def get_administrator_permission(self, administrator_id: int):
        return self.get_administrator_permission_api(url_kwargs={'administrator-id': administrator_id})
    
    def init_business_log_table(self, system_ids: str = None):
        return self.init_business_log_table_api(params=dict(systemIds=system_ids))
    
    def alter_business_log_table(self, system_ids: str = None):
        return self.alter_business_log_table_api(params=dict(systemIds=system_ids))
    
    def count_permissions(self, include_facade: bool = False, system_ids: str = None):
        return self.count_permissions_api(params=dict(includeFacade=include_facade, systemIds=system_ids))
    
    def execute_upload_sql(self, env: str = None, password: str = None, schema_type: int = None, sponsor_id: int = None, study_id: int = None, system_id: int = None, file=None):
        return self.execute_upload_sql_api(params=dict(env=env, password=password, schemaType=schema_type, sponsorId=sponsor_id, studyId=study_id, systemId=system_id), multipart_encoder_kwargs=dict(file=file))
    
    def clean_release_package(self, password: str = None, release_package_name: str = None):
        return self.clean_release_package_api(params=dict(password=password, releasePackageName=release_package_name))
    
    def execute_upload_sql_in_portal(self, password: str = None, file=None):
        return self.execute_upload_sql_in_portal_api(params=dict(password=password), multipart_encoder_kwargs=dict(file=file))
    
    def execute_complex_sql_in_portal(self, password: str = None, file=None):
        return self.execute_complex_sql_in_portal_api(params=dict(password=password), multipart_encoder_kwargs=dict(file=file))
    
    def change_my_password(self, change_user_password: ChangeUserPassword = None):
        return self.change_my_password_api(json=change_user_password)
    
    def administrator_auth_sso_token(self, token_retrieve: SsoTokenRetrieveDto = None):
        return self.administrator_auth_sso_token_api(json=token_retrieve)
    