import { User } from '../models/users/user';
import { BaseService } from './abstract/baseService';
import localStorageService from './localStorageService';

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

    public isWatchingNonstop: boolean = false;
    public hasExceededPointsLimit: boolean = false;
    public pointsLimitMessage: string = '';

    protected logTag: string = 'ConnectService';

    get currentUser(): User | null {
        return localStorageService.currentUser;
    }

    set currentUser(currentUser: User | null) {
        localStorageService.currentUser = currentUser;
    }

    get activePurchases(): string[] | null {
        return localStorageService.activePurchases;
    }

    set activePurchases(activePurchases: string[] | null) {
        localStorageService.activePurchases = activePurchases;
    }

    get isConnected(): boolean {
        return this.currentUser !== null;
    }
}

export default ConnectService.sharedInstance as ConnectService;