#!/usr/bin/env php
<?php

function includeIfExists($file)
{
    if (file_exists($file)) {
        return include $file;
    }
}

$loader = __DIR__ . '/../vendor/autoload.php';

if (!file_exists($loader)) {
    $loader = __DIR__ . '/../../../autoload.php';
}

if (!file_exists($loader)) {
    die(
        'You must set up the project dependencies, run the following commands:' . PHP_EOL .
        'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
        'php composer.phar install' . PHP_EOL
    );
}

require $loader;

use GrowChart\Command;
use Symfony\Component\Console\Application;

$application = new Application('GROW Console Client', '0.0.1');
$application->setCatchExceptions(true);
$application->add(new Command\RegisterPregnancyCommand());
$application->add(new Command\AddMeasurementCommand());
$application->add(new Command\GetImageCommand());
$application->add(new Command\RegisterBirthCommand());
$application->add(new Command\RegisterBabyCommand());
$application->add(new Command\GetDataCommand());
$application->add(new Command\GetPdfCommand());
$application->add(new Command\ClearDataCommand());
$application->add(new Command\GetPregnancyCommand());
$application->add(new Command\UpdateMeasurementCommand());
$application->add(new Command\RemoveMeasurementCommand());
$application->add(new Command\RegisterPregnanciesCommand());
$application->run();
