<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\WorkCalendar;
use App\Models\HolidaySchedule;
use Illuminate\Http\Request;

class MasterCalendarController extends Controller
{
    // Mengambil kalender kerja dan libur
    public function index() {
        return response()->json([
            'work_calendars' => WorkCalendar::all(),
            'holidays' => HolidaySchedule::all()
        ]);
    }

    // Menyimpan jadwal libur
    public function storeHoliday(Request $request) {
        $holiday = HolidaySchedule::create($request->all());
        return response()->json(['success' => true, 'data' => $holiday]);
    }
}