<?php

namespace App\Http\Controllers;

use App\Models\ClassRegistration;
use Illuminate\Http\Request;

class ClassRegistrationController extends Controller
{
 public function register(Request $request)
{
    $validated = $request->validate([
        'class_name' => 'required|string|max:255',
        'full_name' => 'required|string|max:255',
        'email' => 'required|email|max:255',
        'phone' => 'required|string|max:20',
        'membership_status' => 'required|in:member,non-member,guest',
        'class_schedule' => 'nullable|string'
    ]);

    $registration = ClassRegistration::create($validated);

    return response()->json([
        'success' => true,
        'message' => 'Registration successful!',
        'class_name' => $validated['class_name'],
        'email' => $validated['email']
    ]);
}

}