import { BaseAdapter } from '@humand-packages/common';
import { Service } from 'typedi';
import { TimeTrackingUserSettingData, UsersTimeTrackingSettingPort } from '../../../users/business/ports/usersTimeTrackingSettingPort';
import TimeTrackingUserSettingForUserCreationService from '../../business/services/timeTracking/timeTrackingUserSettingForUserCreation';

@Service()
export class UsersTimeTrackingSettingAdapter extends BaseAdapter implements UsersTimeTrackingSettingPort {
    constructor(private readonly service: TimeTrackingUserSettingForUserCreationService) {
        super();
    }

    async existsByInstanceIdAndKioskPin(instanceId: number, kioskPin: string, userId?: number): Promise<boolean> {
        return this.service.existsByInstanceIdAndKioskPin(instanceId, kioskPin, userId);
    }

    async updateKioskPin(instanceId: number, userId: number, kioskPin: string): Promise<void> {
        await this.service.updateKioskPin(instanceId, userId, kioskPin);
    }

    async getTimeTrackingUserSetting(instanceId: number, userId: number): Promise<TimeTrackingUserSettingData> {
        return this.service.getTimeTrackingUserSetting(instanceId, userId);
    }
}
