<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ContactController extends Controller
{
    /**
     * GET /api/v1/contacts?token=
     */
    public function index(Request $request)
    {
        $user = $request->user();

        // contacts table not yet built — return stub
        return response()->json([
            'success' => true,
            'data'    => [],
            'total'   => 0,
            'message' => 'Contacts module coming soon.',
        ]);
    }

    /**
     * POST /api/v1/contacts?token=
     *
     * Body: { "name": "John Doe", "phone": "919876543210" }
     */
    public function store(Request $request)
    {
        $request->validate([
            'name'  => ['required', 'string', 'max:255'],
            'phone' => ['required', 'string', 'max:20'],
        ]);

        $user = $request->user();

        // contacts table not yet built — return stub
        return response()->json([
            'success' => true,
            'data'    => [
                'name'  => $request->name,
                'phone' => $request->phone,
            ],
            'message' => 'Contacts module coming soon. Contact not persisted yet.',
        ], 201);
    }
}
