import { BaseRepositoryPort } from '@humand-packages/common';
import { CategorizedHourStatusOverride } from '../../../business/models/timeTracking/categorizedHourStatusOverride';
import {
    ActiveCategorizedHourSummary,
    CategorizedHourDataUpdate,
    SavedPendingCategorizedHour,
    TimeTrackingCategorizedHourForCreation,
} from '../../../business/models/timeTracking/timeTrackingCategorizedHour';
import { TimeTrackingCategorizedHourStatus } from '../../constants/timeTracking/categorizedHourStatus';

export abstract class TimeTrackingCategorizedHourRepositoryPort extends BaseRepositoryPort {
    abstract bulkCreateCategorizedHours(categorizedHours: TimeTrackingCategorizedHourForCreation[]): Promise<SavedPendingCategorizedHour[]>;

    abstract existsCategorizedHour(id: string, instanceId: number): Promise<boolean>;

    abstract isFrozenByAdminRejection(id: string, instanceId: number): Promise<boolean>;

    abstract updateCategorizedHourStatus(
        id: string,
        instanceId: number,
        status: TimeTrackingCategorizedHourStatus,
        override?: CategorizedHourStatusOverride | null,
    ): Promise<void>;

    abstract bulkDeleteCategorizedHours(
        instanceId: number,
        userIds: number[],
        hourCategoryId: number,
        startDate: string,
        endDate: string,
        status: TimeTrackingCategorizedHourStatus,
    ): Promise<void>;

    abstract findActiveCategorizedHoursWithApproval(
        instanceId: number,
        userIds: number[],
        hourCategoryIds: number[],
        startDate: string,
        endDate: string,
    ): Promise<ActiveCategorizedHourSummary[]>;

    abstract bulkUpdateCategorizedHoursStatusForUsersInRange(
        instanceId: number,
        userIds: number[],
        hourCategoryIds: number[],
        startDate: string,
        endDate: string,
        currentStatuses: TimeTrackingCategorizedHourStatus[],
        newStatus: TimeTrackingCategorizedHourStatus,
    ): Promise<void>;

    abstract bulkUpdateCategorizedHoursData(updates: CategorizedHourDataUpdate[], instanceId: number): Promise<void>;

    abstract deleteCategorizedHoursByIds(ids: string[]): Promise<void>;

    abstract getCategorizedHourStatus(id: string, instanceId: number): Promise<TimeTrackingCategorizedHourStatus>;

    abstract updateCategorizedHourValue(id: string, instanceId: number, hours: number): Promise<void>;
}
