"""
Performs management commands for the scheduler app
"""
import hashlib

from flask.ext.script import Manager
from sqlalchemy import exc

# Importing routes causes our URL routes to be registered
from src import routes
from src import models
from src import scheduler

scheduler.app.config.from_object(scheduler.ConfigDevelopment)
manager = Manager(scheduler.app)


def 
():
    """
    Adds two coaches (for testing)
    """
    user_1 = models.User(
        id='ecf1bcae-9c8f-11e5-b5b4-d895b95699bb',
        fullname='Pat Blargstone',
        username='pat',
        password=hashlib.md5('secret').hexdigest())
    coach_1 = models.Coach(
        id='ee8d1d30-9c8f-11e5-89d4-d895b95699bb',
        user_id=user_1.id)
    user_2 = models.User(
        id='ef2a95b0-9c8f-11e5-bd27-d895b95699bb',
        fullname='Sandy Blargwright',
        username='sandy',
        password=hashlib.md5('secret').hexdigest())
    coach_2 = models.Coach(
        id='efad3330-9c8f-11e5-9654-d895b95699bb',
        user_id=user_2.id)

    try:
        scheduler.db.session.add(user_1)
        scheduler.db.session.add(user_2)
        scheduler.db.session.add(coach_1)
        scheduler.db.session.add(coach_2)
        scheduler.db.session.commit()
    except exc.SQLAlchemyError:
        pass


if __name__ == '__main__':
    scheduler.db.create_all()
    add_coaches()
    manager.run()

add_coaches