import { Reward } from '../models/tasks/reward';
import { TaskType } from '../models/tasks/taskType';
import { PointsWidgetConfig } from '../models/views/pointswidgetconfig';
import { ChoiceCardView } from '../views/choiceCards/choiceCardView';
import { PointsWidget } from '../views/pointsWidget';
import { RewardCardView } from '../views/rewardCards/rewardCardView';
import { BaseService } from './abstract/baseService';

class CardService extends BaseService {
    public static sharedInstance = new CardService();

    protected logTag: string = 'CardService';

    public async presentRewardCard(task: TaskType, reward: Reward, onStartCallback?: () => void): Promise<boolean> {
        const rewardCardView = new RewardCardView(task, reward);
        return await rewardCardView.presentSelf(onStartCallback);
    }

    public async presentChoiceCard(contentId: string, inElement: HTMLElement, isContinueWatching: boolean): Promise<boolean> {
        const choiceCardView = new ChoiceCardView(contentId, inElement, isContinueWatching);
        return await choiceCardView.presentSelf();
    }

    public async presentPointsWidget(inElement: HTMLElement, withConfig: PointsWidgetConfig): Promise<boolean> {
        const pointsWidget = new PointsWidget(inElement, withConfig);
        return await pointsWidget.presentSelf();
    }
}

export default CardService.sharedInstance as CardService;