#!/usr/bin/env perl
use strict;
use warnings;
use 5.014;
use lib 'local/lib/perl5';
use lib 'lib';
use HomePanel::Driver;
use Path::Tiny;
use Config::Any;

my $cfg_set = Config::Any->load_files({
    files => \@ARGV,
    use_ext => 1,
});

my %config = map { %{(values %$_)[0]} } @$cfg_set;

my $hp = HomePanel::Driver->new({
    template_file => ($config{template} || path(__FILE__)->parent->child('forecast.html.tt')),
    output_file => ($config{output_file} || path(__FILE__)->parent->child('forecast.html')),
    forecast_key => $config{forecast_key},
    forecast_latitude => $config{forecast_latitude},
    forecast_longitude => $config{forecast_longitude},
    bus_stop_ids => $config{bus_stop_id},
});

$hp->start;
$hp->loop->run;
