#!/usr/bin/python3

import argparse
import sys

from erimp import Erimp
from sidat import Sidat
from resip import Resip

desc = 'study seed configuration'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('-v', action='store_true', help='raise verbosity')
parser.add_argument('-r', action='store_true', help='run resip only')
parser.add_argument('bapis', metavar='bnp', type=str, nargs='*',
                    help='bits and pieces arguments')
args = parser.parse_args()

e = Erimp(args.bapis, do_verbose=args.v)
if 'no_seeds' in e.conf:
    print("I can't do seeds with your erimp.")
    quit()

# # first script that has verbosity in the object
sidat = Sidat(erimp=e, do_verbose=args.v)
resip = Resip(erimp=e, do_verbose=args.v)

## essentially for testing
if args.r:
    if e.given_repcode is None:
        print("I can't run -r without a repcode")
        sys.exit()
    repcode = e.given_repcode
    resip.work(repcode)
    quit()

if e.given_repcode is not None:
    sidat.update_report(e.given_repcode)
    print("I start with resip.")
    resip.work(e.given_repcode)
    quit()
