import type { Service } from '../types';

/** Null storage service used when persistence is unavailable. */
export default class NullStorageService implements Service
{
    public name = 'NullStorageService';
    public readonly serviceType = 'storage';
    protected _cache: Record<string, unknown> = {};

    public get id(): string
    {
        return __STORAGE_ID;
    }

    public get storageKey(): string
    {
        return `${this.id}${__OPTIONS__.cache_player_id}`;
    }

    public set(_key: string, _value: unknown): void {}

    public get<T = unknown>(_key: string): T | null
    {
        return null;
    }

    public readData(): void {}

    public writeData(): void {}

    public delete(_key: string): void {}

    public checkAvailable(): boolean
    {
        return false;
    }

    public dispose(): void
    {
        this._cache = {};
    }
}
