# encoding: UTF-8
from ..dao.createDataDetailDao import CreateDetailDao


class CreateDetailService(object):
    def __init__(self):
        pass

    @staticmethod
    def get_all_detail_list_no_filters_page(session):
        scene_list, total = CreateDetailDao.get_all_detail_list_no_filters(session)
        return scene_list, total

    @staticmethod
    def get_detail_list_no_filters_page(session, page, limit):
        scene_list, total = CreateDetailDao.get_detail_list_no_filters(session, page=page, limit=limit)
        return scene_list, total

    @staticmethod
    def get_detail_list_by_filters_page(session, filter_list, page, limit):
        ret, err_msg = CreateDetailDao.get_detail_list_by_filters(session, filter_list, page=page, limit=limit)
        return ret, err_msg

    @staticmethod
    def get_detail_list_by_filters_team_page(session, filter_list, list_team_name, page, limit):
        ret, err_msg = CreateDetailDao.get_detail_list_by_filters_by_team(session, filter_list,
                                                                          list_team_name=list_team_name,
                                                                          page=page, limit=limit)
        return ret, err_msg

    @staticmethod
    def get_detail_list_no_filters_team_page(session, list_team_name, page, limit):
        scene_list, total = CreateDetailDao.get_detail_list_no_filters_by_team(session, list_team_name=list_team_name,
                                                                               page=page, limit=limit)
        return scene_list, total

    @staticmethod
    def get_detail_simple_data_by_filters(session, filter_list):
        ret = CreateDetailDao.get_detail_simple_by_filters(session, filter_list)
        return ret

    @staticmethod
    def get_create_detail_info_by_id(session, create_data_detail_id):
        err_msg = CreateDetailDao.get_create_detail_info_by_id(session, create_data_detail_id)
        return err_msg

    @staticmethod
    def create_service_detail_data(session, create_info):
        ret = CreateDetailDao.save_detail_info_record(session, create_info)
        return ret

    @staticmethod
    def update_service_detail_data(session, update_info, create_data_detail_id):
        err_msg = CreateDetailDao.update_detail_info_record(session, update_info, create_data_detail_id)
        return err_msg

    @staticmethod
    def delete_service_detail_data(session, create_data_detail_id):
        bf_dao = CreateDetailDao()
        del_info = bf_dao.delete_detail_info_record(session, create_data_detail_id)
        return del_info
