<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class TrainingWorkoutLine extends Model
{
    protected $fillable = [
        "training_workout_section_id","description", "exercise_id", "seconds", "reps", "maleVal", "femaleVal", "units",
        "exercise_scaled_id", "seconds_scaled", "reps_scaled", "maleVal_scaled", "femaleVal_scaled", "units_scaled"
    ];

    protected $with = ["exercise","exercise_scaled"];

    protected $hidden = ["pivot"];

    public function trainingWorkoutSections() {
        return $this->belongsTo("App\TrainingWorkoutSection");
    }

    public function exercise() {
        return $this->hasOne("App\Exercise", "id", "exercise_id");
    }

    public function exercise_scaled() {
        return $this->hasOne("App\Exercise", "id", "exercise_scaled_id");
    }

    public function user_benchmarks_lines() {
        return $this->hasMany("App\UserBenchmarkLine", "training_section_line_id")
            ->withPivot("level", "time", "sets", "reps", "maleVal", "femaleVal", "units")
            ->withTimestamps();;
    }

}
