#!/usr/bin/env python

## - For testing - ##
import sys
sys.path.insert(0,'../')
## - - - ### - - - ##
try:
    from Market import Market
    from Business import Business
except:
    from mural.Market import Market
    from mural.Business import Business



import argparse,yaml
from PyInquirer import style_from_dict, Token, prompt, Separator,Validator, ValidationError
import sys
parser = argparse.ArgumentParser(description='Utility used to view the property of a business.')
parser.add_argument('name', metavar='name', type=str, nargs=1, help="The name of a business.")
if len(sys.argv) == 1:
    businesses=[n['name'] for n in Business.all()]
    questions=[
        {
            'type': 'list',
            'name': 'name',
            'message': 'What is the name of the busines you would like to look up?',
            'choices': businesses,
        },
    ]
    answers=prompt(questions)
    name=answers['name']
else:
    args=parser.parse_args()
    name=args.name[0]
print("Looking up the business %s"%name)
Business.load(name).display()
    
