use v6;

use lib <. lib>;

use ML::StreamsBlendingRecommender::CoreSBR;
use Test;

plan 7;

##-----------------------------------------------------------
## Creation and ingestion
##-----------------------------------------------------------

my Str $fileName = $*CWD.Str ~ '/resources/' ~ 'WLExampleData-dfSMRMatrix.csv';

my $sbrCore = ML::StreamsBlendingRecommender::CoreSBR.new;

ok $fileName.chars > 0, '$fileNameIDF';

ok $sbrCore.ingest-smr-marrix-csv-file($fileName, :make).take-smr-matrix.elems > 3000,
        'ingest SMR matrix from CSV file';


##-----------------------------------------------------------
## Recommendations by profile
##-----------------------------------------------------------
my @prof = <ApplicationArea:Aviation DataType:TimeSeries>;
my %recsIDF = $sbrCore.recommend-by-profile(@prof, 10, :normalize, :!object);

ok %recsIDF.elems == 10, 'recsIDF.elems';

is %recsIDF<Statistics-AirlinePassengerMiles>:exists, True;

is abs(%recsIDF<Statistics-AirlinePassengerMiles> - 1.0) < 1.0e-10, True;

is %recsIDF<Statistics-InternationalAirlinePassengers>:exists, True;

is abs(%recsIDF<Statistics-InternationalAirlinePassengers> - 1.0) < 1.0e-10, True;

done-testing;
