<?php

namespace App\Http\Controllers\Barobill;

use App\Http\Controllers\Controller;
use App\Models\Barobill\BarobillMember;
use App\Models\Tenants\Tenant;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\View\View;

class SmsController extends Controller
{
    /**
     * SMS 발송 테스트
     */
    public function send(Request $request): View|Response
    {
        if ($request->header('HX-Request')) {
            return response('', 200)->header('HX-Redirect', route('barobill.sms.send'));
        }

        $tenantId = session('selected_tenant_id', 1);
        $currentTenant = Tenant::find($tenantId);
        $barobillMember = BarobillMember::where('tenant_id', $tenantId)->first();

        return view('barobill.sms.send.index', compact('currentTenant', 'barobillMember'));
    }
}
