<?php

namespace App\Http\Controllers;

use App\Services\AdminMetricsService;
use Illuminate\Http\Request;

class AdminMarketingController extends Controller
{
    public function index(Request $request, AdminMetricsService $metrics)
    {
        [$period, $from, $to] = $metrics->rangeFromRequest($request);

        return view('admin.marketing.index', [
            'period' => $period,
            'from' => $from,
            'to' => $to,
            'data' => $metrics->marketing($from, $to),
        ]);
    }
}
