#!/usr/bin/env python3

# Copyright (C) 2025 Volkov Alexey
#
# 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 of the License,
# 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, see <https://www.gnu.org/licenses/>.

from alt_workstation_10_11_upgrade.upgrade import run_upgrade
from alt_workstation_10_11_upgrade.switch import run_switch

import argparse

def parse_args():
	parser = argparse.ArgumentParser()
	parser.add_argument(
		"-y", "--yes",
		action="store_true",
		help="Assume Yes to all queries and do not prompt"
	)
	group = parser.add_mutually_exclusive_group(required=False)
	group.add_argument(
		"-u", "--upgrade",
		action="store_true",
		help="Only upgrade the system to P11"
	)
	group.add_argument(
		"-s", "--switch",
		action="store_true",
		help="Only apply switch to upgraded system"
	)
	return parser.parse_args()

def main():
	args = parse_args()
	assume_yes = False

	if args.yes:
		assume_yes = True

	if args.upgrade:
		print("Only upgrading to P11")
		run_upgrade(assume_yes)
	elif args.switch:
		print("Only switching from MATE to GNOME")
		run_switch(assume_yes)
	else:
		run_upgrade(assume_yes)
		run_switch(assume_yes)

if __name__ == "__main__":
	main()
