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

const EMPTY_MANIFEST: AssetsManifest = Object.freeze({ bundles: [] });

/**
 * No-op manifest service used when asset loading is not configured.
 */
export default class NullManifestService implements Service
{
    public name = 'NullManifestService';
    public readonly serviceType = 'manifest';

    /** Ignore added sources while keeping the fluent API. */
    public add(_source: string | AssetsManifest): this
    {
        return this;
    }

    public async load(): Promise<void>
    {
        // Nothing to load in the null variant.
    }

    /** Always returns an empty manifest. */
    public getMerged(): AssetsManifest
    {
        return EMPTY_MANIFEST;
    }

    public clear(): void
    {
        // Nothing to clear.
    }

    public dispose(): void
    {
        // Nothing to release.
    }
}
