#! /usr/bin/python3 -s
# -*- coding: utf-8 -*-

################################################################################
#
# ROSA Device Manager
#
# Copyright (c) 2020   LLC "STC IT ROSA"
# License: GPLv3+
# Authors:
#     Ural Mullabaev <u.mullabaev@ntcit-rosa.ru>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
################################################################################


import sys
import argparse

from PyQt5.QtCore import QCoreApplication

if __name__ == '__main__':
    import rosa_device_manager.constants as const
    from rosa_device_manager.core_application import CoreApplication
    from rosa_device_manager.argparser import ArgumentParser, HelpFormatter
else:
    import src.constants as const
    from src.core_application import CoreApplication
    from src.argparser import ArgumentParser, HelpFormatter

app = CoreApplication(sys.argv)

_translate = QCoreApplication.translate

# parse arguments
parser = ArgumentParser(prog=const.APP_NAME, \
                                 description=const.APP_FULLNAME+" - "+_translate("Arguments", "program for identification and blocking devices"), \
                                 add_help=False, formatter_class=HelpFormatter)
parser.add_argument("-c", "--create", action="store_true", help=_translate("Arguments", "create device identification rules"))
parser.add_argument("-u", "--update", action="store_true", help=_translate("Arguments", "update device identification rules that will be created at next system boot"))
parser.add_argument("-a", "--add", action="store_true", help=_translate("Arguments", "add identification rule for last unidentified device"))
#parser.add_argument("-r", "--remove", metavar="ATTRIBUTES", help=_translate("Arguments", "remove identification rule for device with specified attributes"))
parser.add_argument("-e", "--enable", action="store_true", help=_translate("Arguments", "enable device identification"))
parser.add_argument("-d", "--disable", action="store_true", help=_translate("Arguments", "disable device identification"))
parser.add_argument("-b", "--blocking", action="store_true", help=_translate("Arguments", "set blocking mode for unidentified devices "))
parser.add_argument("-n", "--non_blocking", action="store_true", help=_translate("Arguments", "set non-blocking mode for unidentified devices "))
parser.add_argument("-l", "--logging", action="store_true", help=_translate("Arguments", "set extend event logging mode"))
parser.add_argument("-q", "--quiet", action="store_true", help=_translate("Arguments", "unset extend event logging mode"))
parser.add_argument("-s", "--settings", action="store_true", help=_translate("Arguments", "show current mode settings"))
parser.add_argument("-t", "--temporary", action="store_true", help=_translate("Arguments", "remove temporary files"))
parser.add_argument("-h", "--help", action="help", default=argparse.SUPPRESS, help=_translate("Arguments", "show this help message"))

# run the application
sys.exit(app.exec_(parser))
