#!/usr/bin/env python

import argparse
from ..lib.DataBeaver import DataBeaver


def main():
    """
    Command Line Script for the data_beaver module


    Command Line Usage
        ./fbb.py <action> - General Format

    Responsible For
        1. Parsing Command Line Arguments
        2. Validating the action requested is a valid action
        3. Calling the run() method of the requested action
    :return:
    """
    command_arguments = {'build': [], 'dependencies':[], 'destroy': [], 'create-project': ['--type']}
    # TODO: Get a better tag line
    desc = "Data Beaver - Building your Data Warehouse... One Table At A Time"
    print(desc)
    return

    parser = argparse.ArgumentParser(description=desc)
    parser.add_argument('action')
    args = parser.parse_known_args()[0]

    beaver = DataBeaver()

    # Parse the command line again, now with command specific arguments
    if args.action in command_arguments:
        for argument in command_arguments[args.action]:
            parser.add_argument(argument)
        args = parser.parse_known_args()[0]

    if args.action == 'build':
        beaver.build(args)
    elif args.action == 'create-project':
        beaver.create_project()
    elif args.action == 'dependencies':
        beaver.model_dependencies(args)
    elif args.action == 'destroy':
        beaver.destroy(args)
    else:
        print(f"{args.action} not defined")


# Base Call
main()
