<?php

namespace App\Http\Controllers\ClaudeCode;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\View\View;
use Symfony\Component\HttpFoundation\BinaryFileResponse;

class PricingController extends Controller
{
    public function index(Request $request): View|Response
    {
        if ($request->header('HX-Request')) {
            return response('', 200)->header('HX-Redirect', route('claude-code.pricing.index'));
        }

        return view('claude-code.pricing.index');
    }

    public function download(): BinaryFileResponse
    {
        $path = public_path('downloads/claude-code-pricing.pptx');

        abort_unless(file_exists($path), 404, 'PPTX 파일을 찾을 수 없습니다.');

        return response()->download($path, 'Claude_Code_요금정책_비교분석.pptx');
    }
}
