import { TimeTrackingEntryMessage } from '@humand/desert-eagle-grpc-ts-client';
import { BasePort } from '@humand-packages/common';
import { TimeTrackingAutoCloseEntry } from '../../../business/models/timeTracking/autoCloseEntry';
import { AutoCloseEntryResult } from '../../../business/models/timeTracking/timeTrackingHighAvailability';
import { TimeTrackingEntry } from '../../../business/models/timeTrackingEntry';

export interface UpdateEntriesResult {
    createdEntries?: Array<{ entryId?: string; [key: string]: any }>;
    deletedEntryIds?: string[];
    message?: string;
    success: boolean;
    updatedEntries?: Array<{ entryId?: string; [key: string]: any }>;
}

export abstract class TimeTrackingEntriesRepositoryPort extends BasePort {
    abstract createTimeTrackingEntry(
        entry: Partial<TimeTrackingEntry>,
        botAppId?: number,
    ): Promise<TimeTrackingEntryMessage.TimeTrackingEntryResponse>;

    abstract updateEntries(
        instanceId: number,
        deletedEntries: TimeTrackingEntry[],
        modifiedEntries: Partial<TimeTrackingEntry>[],
        newEntries: Partial<TimeTrackingEntry>[],
    ): Promise<UpdateEntriesResult>;

    abstract processAutoCloseEntries(entries: TimeTrackingAutoCloseEntry[]): Promise<AutoCloseEntryResult[]>;
}
