# Path: scar/providers/aws/response.py
# class OutputType(Enum):
#     PLAIN_TEXT = 1
#     JSON = 2
#     VERBOSE = 3
#     BINARY = 4


from typing import Dict, List
from tabulate import tabulate
from scar.providers.aws.response import OutputType
import scar.logger as logger
# Copyright (C) GRyCAP - I3M - UPV
#
# 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.
"""Module with the class implementing the low-level functions to
communicate with an OSCAR cluster."""



def parse_ls_response(oscar_resources: List, endpoint: str, cluster_id: str, output_type: int) -> None:
    oscar_output = 'Services'
    result = []
    text_message = f'\nOSCAR SERVICES - CLUSTER "{cluster_id}" ({endpoint}):\n'
    for resources_info in oscar_resources:
        result.append(_parse_service_info(resources_info))
    text_message += _get_table(result)
    _print_generic_response({oscar_output: oscar_resources}, output_type, text_message, {oscar_output: result})


def parse_service_creation(resources_info: Dict, output_type: int) -> None:
    result = _parse_service_info(resources_info)

# Path: scar/providers/aws/response.py
# class OutputType(Enum):
#     PLAIN_TEXT = 1
#     JSON = 2
#     VERBOSE = 3
#     BINARY = 4


# Path: scar/providers/oscar/response.py
from typing import Dict, List
from tabulate import tabulate
from scar.providers.aws.response import OutputType
import scar.logger as logger

# Copyright (C) GRyCAP - I3M - UPV
#
# 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.
"""Module with the class implementing the low-level functions to
communicate with an OSCAR cluster."""



def parse_ls_response(oscar_resources: List, endpoint: str, cluster_id: str, output_type: int) -> None:
    oscar_output = 'Services'
    result = []
    text_message = f'\nOSCAR SERVICES - CLUSTER "{cluster_id}" ({endpoint}):\n'
    for resources_info in oscar_resources:
        result.append(_parse_service_info(resources_info))
    text_message += _get_table(result)
    _print_generic_response({oscar_output: oscar_resources}, output_type, text_message, {oscar_output: result})


def parse_service_creation(resources_info: Dict, output_type: int) -> None:
    result = _parse_service_info(resources_info)

    text_message = f'Service \'{resources_info["name"]}\' successfully created on cluster \'{resources_info.get("cluster_id")}\'.'