{{#if (eq this.layout "calendar")}}
    {{! ===== CALENDAR VIEW ===== }}
    {{! @events receives a function (fetchInfo, successCallback, failureCallback) — }}
    {{! FullCalendar v6 calls it automatically on render and navigation. }}
    <Layout::Section::Header @title={{t "resource.maintenance-schedules"}} @actionsWrapperClass="space-x-1">
        <Layout::Resource::TabularActions
            @searchQuery={{this.query}}
            @onSearch={{perform this.scheduleActions.controllerSearchTask this}}
            @columns={{this.columns}}
            @page={{this.page}}
            @onPageChange={{fn (mut this.page)}}
            @actionButtons={{this.actionButtons}}
            @bulkActions={{this.bulkActions}}
            @controller={{this}}
            @hideColumnsPicker={{true}}
        />
    </Layout::Section::Header>

    <Layout::Section::Body class="overflow-y-scroll-i h-full">
        <div class="p-4">
            <FullCalendar @events={{this.calendarEventSource}} @onEventClick={{this.onCalendarEventClick}} @onInit={{this.setCalendarApi}} />
        </div>
    </Layout::Section::Body>
{{else}}
    {{! ===== LIST VIEW (default) ===== }}
    <Layout::Resource::Tabular
        @resource="maintenance-schedule"
        @title={{t "resource.maintenance-schedules"}}
        @searchQuery={{this.query}}
        @onSearch={{perform this.scheduleActions.controllerSearchTask this}}
        @data={{@model}}
        @columns={{this.columns}}
        @page={{this.page}}
        @onPageChange={{fn (mut this.page)}}
        @actionButtons={{this.actionButtons}}
        @bulkActions={{this.bulkActions}}
        @controller={{this}}
        @emptyStateComponent={{component
            "table/empty-state"
            icon="calendar-check"
            title="Create your first maintenance schedule"
            description="Schedules help automate preventive work and keep service intervals visible before assets fall behind."
            filteredTitle="No maintenance schedules match your filters"
            filteredDescription="Adjust the search or filters to find another schedule."
            primaryText="New schedule"
            primaryIcon="plus"
            primaryAction=this.maintenanceScheduleActions.transition.create
            secondaryText="Import"
            secondaryIcon="upload"
            secondaryAction=this.maintenanceScheduleActions.import
            docsSlug="fleet-ops/maintenance/schedules/overview"
            docsTitle="Schedules guide"
            docsText="Schedules guide"
            docsSource="fleet-ops-empty-maintenance-schedules"
        }}
    />
{{/if}}
{{outlet}}
