<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Chrono extends Model
{
    protected $table      = 'chronos';
    protected $connection = 'default';
    public $timestamps    = false;

    protected $fillable = [
        'user_id', 'produit_id', 'duree_secondes', 'source', 'statut',
        'date_debut', 'date_fin', 'strava_activity_id', 'score_detection',
        'auto_valide', 'ajustement_secondes', 'created_at',
    ];

    public function user()    { return $this->belongsTo(User::class, 'user_id'); }
    public function produit() { return $this->belongsTo(Produit::class, 'produit_id'); }
    public function commande(){ return $this->hasOne(Commande::class, 'chrono_id'); }
}
