<?php

use App\Repositories\TrainingWorkoutRepository;
use App\TrainingWorkoutSection;
use App\TrainingWorkout;
use App\TrainingWorkoutLine;
use Illuminate\Database\Seeder;

class TrainingWorkoutTemplatesSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $string = file_get_contents(__DIR__ . "/../../utils/workouts.json");
        $json = json_decode($string, true);
        foreach($json["workouts"] as $workout) {
            echo "Creating workout " . $workout["name"] . "... ";
            TrainingWorkoutRepository::create($workout);
            echo "OK.\n";
        }
    }
}
