import argparse
import sqlite3


def show_students(conn):
    pass


def show_enrollments(conn):
    pass


def add_student(conn, id, name):
    pass


def enroll_student(conn, student, course):
    pass


def declare_major(conn, student, department):
    pass


def main():
    argparser = argparse.ArgumentParser(
        description="Interact with the university database"
    )
    argparser.add_argument(
        "database",
        help="SQLite database file",
    )
    argparser.add_argument(
        "--add-student",
        metavar=("ID", "NAME"),
        nargs=2,
        help="Add a student",
    )
    argparser.add_argument(
        "--enroll-student",
        metavar=("STUDENT", "COURSE"),
        nargs=2,
        help="Enroll a student in a course",
    )
    argparser.add_argument(
        "--declare-major",
        metavar=("STUDENT", "DEPARTMENT"),
        nargs=2,
        help="Declare a student's major",
    )
    argparser.add_argument(
        "--show-students",
        action="store_true",
        help="List all students IDs, names, and their majors",
    )
    argparser.add_argument(
        "--show-enrollments",
        action="store_true",
        help="List all courses and the number of students enrolled",
    )
    args = argparser.parse_args()
    conn = sqlite3.connect(args.database)
    conn.execute("PRAGMA foreign_keys = ON")
    if args.add_student:
        add_student(conn, *args.add_student)
    if args.enroll_student:
        enroll_student(conn, *args.enroll_student)
    if args.declare_major:
        declare_major(conn, *args.declare_major)
    if args.show_students:
        show_students(conn)
    if args.show_enrollments:
        show_enrollments(conn)


if __name__ == "__main__":
    main()
