<?php

namespace App\Services;

use App\Repositories\MoodEntryRepository;
use Illuminate\Support\Facades\Auth;

class MoodService
{
    protected $moodRepo;

    public function __construct(MoodEntryRepository $moodRepo)
    {
        $this->moodRepo = $moodRepo;
    }

    public function getRecentMoods($limit = 7)
    {
        return $this->moodRepo->getUserMoods(Auth::id(), $limit);
    }

    public function getMoodStats($days = 30)
    {
        return $this->moodRepo->getMoodStats(Auth::id(), $days);
    }

    public function createMood(array $data)
    {
        $data['user_id'] = Auth::id();
        $data['entry_date'] = $data['entry_date'] ?? now()->toDateString();
        return $this->moodRepo->create($data);
    }
}
