import { OnInit, OnDestroy } from '@angular/core';
import { BaseResourceComponent } from '@memberjunction/ng-shared';
import { ResourceData } from '@memberjunction/core-entities';
import * as i0 from "@angular/core";
interface ScheduleRow {
    ID: string;
    Name: string;
    Integration: string;
    Company: string;
    IsActive: boolean | null;
    ScheduleEnabled: boolean;
    ScheduleType: 'Manual' | 'Interval' | 'Cron';
    ScheduleIntervalMinutes: number | null;
    CronExpression: string | null;
    NextScheduledRunAt: string | null;
    LastScheduledRunAt: string | null;
    IsLocked: boolean;
    LockedAt: string | null;
    ScheduledJobID: string | null;
}
interface TimelineMarker {
    Hour: number;
    Minute: number;
    IsNext: boolean;
}
interface TimelineRow {
    IntegrationID: string;
    IntegrationName: string;
    Markers: TimelineMarker[];
    IsLocked: boolean;
}
interface IntervalPreset {
    Label: string;
    Minutes: number;
}
interface CronPreset {
    Label: string;
    Expression: string;
}
export declare class SchedulesComponent extends BaseResourceComponent implements OnInit, OnDestroy {
    Schedules: ScheduleRow[];
    IsLoading: boolean;
    SavingID: string | null;
    RunningID: string | null;
    /** Track pending edits per integration ID */
    PendingChanges: Map<string, Partial<ScheduleRow>>;
    /** Timeline data built from schedules */
    TimelineMarkers: TimelineRow[];
    TimelineHours: number[];
    /** Preset interval choices */
    IntervalPresets: IntervalPreset[];
    /** Preset cron expressions */
    CronPresets: CronPreset[];
    private dataService;
    private cdr;
    private refreshTimer;
    /** JobTypeID for "Integration Sync" scheduled job type (from MJ metadata) */
    private readonly INTEGRATION_SYNC_JOB_TYPE_ID;
    ngOnInit(): Promise<void>;
    ngOnDestroy(): void;
    GetResourceDisplayName(_data: ResourceData): Promise<string>;
    GetResourceIconClass(_data: ResourceData): Promise<string>;
    LoadData(): Promise<void>;
    BuildTimeline(): void;
    ToggleScheduleEnabled(integrationID: string): void;
    SetScheduleType(integrationID: string, type: 'Manual' | 'Interval' | 'Cron'): void;
    SetInterval(integrationID: string, minutes: number): void;
    SetCronExpression(integrationID: string, expression: string): void;
    OnCronInputChange(integrationID: string, event: Event): void;
    SetCustomInterval(integrationID: string, event: Event): void;
    HasChanges(integrationID: string): boolean;
    SaveSchedule(integrationID: string): Promise<void>;
    /**
     * Creates, updates, or disables the ScheduledJob record linked to this integration.
     * When enabled with a real schedule type, ensures an Active ScheduledJob exists.
     * When disabled or set to Manual, marks the ScheduledJob as Disabled (if one exists).
     */
    private SyncScheduledJob;
    /** Converts schedule type + config into a cron expression. */
    private ResolveCronExpression;
    /** Converts an interval in minutes to an equivalent cron expression. */
    private IntervalToCron;
    /**
     * Creates a new ScheduledJob or updates the existing one.
     * Returns the ID of the job (new or existing).
     */
    private UpsertScheduledJob;
    /** Sets an existing ScheduledJob to Disabled so it stops firing. */
    private DisableScheduledJob;
    RunNow(integrationID: string): Promise<void>;
    GetEffectiveScheduleEnabled(schedule: ScheduleRow): boolean;
    GetEffectiveScheduleType(schedule: ScheduleRow): 'Manual' | 'Interval' | 'Cron';
    GetEffectiveInterval(schedule: ScheduleRow): number | null;
    GetEffectiveCron(schedule: ScheduleRow): string | null;
    IsIntervalSelected(schedule: ScheduleRow, minutes: number): boolean;
    GetNextRunRelative(schedule: ScheduleRow): string;
    GetLastRunRelative(schedule: ScheduleRow): string;
    GetCronDescription(expression: string | null): string;
    GetIntegrationIcon(name: string): string;
    ComputeTimelinePosition(hour: number, minute: number): number;
    IsSaving(integrationID: string): boolean;
    IsRunning(integrationID: string): boolean;
    get ScheduledCount(): number;
    get LockedCount(): number;
    TrackByID(_index: number, item: ScheduleRow): string;
    TrackTimelineByID(_index: number, item: TimelineRow): string;
    TrackPresetByMinutes(_index: number, item: IntervalPreset): number;
    TrackCronPresetByExpr(_index: number, item: CronPreset): string;
    TrackHour(_index: number, hour: number): number;
    TrackMarker(index: number, _item: TimelineMarker): number;
    private findSchedule;
    private getEffectiveValue;
    private setPendingChange;
    private buildTimelineHours;
    private computeMarkersForSchedule;
    private computeIntervalMarkers;
    private computeCronMarkers;
    private addNextRunMarker;
    /**
     * Approximate cron schedule times within a 24-hour window.
     * Handles common patterns only -- not a full cron parser.
     */
    private approximateCronTimes;
    private formatDurationMs;
    static ɵfac: i0.ɵɵFactoryDeclaration<SchedulesComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<SchedulesComponent, "app-integration-schedules", never, {}, {}, never, never, false, never>;
}
export declare function LoadSchedulesComponent(): void;
export {};
//# sourceMappingURL=schedules.component.d.ts.map