<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\GoogleSheetService;
use Illuminate\Http\Request;

class GoogleSheetController extends Controller
{
    protected $googleSheetService;
    public function __construct(GoogleSheetService $googleSheetService){
        $this->googleSheetService = $googleSheetService;
    }
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        $dataCollection = $this->googleSheetService->getSheetDataCollection();
        $result = [
            "last_row" => $this->googleSheetService->getLastRowByColumn("C"),
            "last_column" => $this->googleSheetService->getLastColumn(),
            "header" => $this->googleSheetService->getHeader(),
            "data_collection" => $dataCollection
        ];
        return response()->json($result);
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     */
    public function show(string $id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Request $request, string $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(string $id)
    {
        //
    }
}
