import { Container } from 'pixi.js';
import { Service } from '../types';

/**
 * NullViewport is a placeholder implementation of the Viewport service.
 *
 * Used by the Locator when no actual Viewport has been registered.
 * All methods are no-ops and getters return safe default values.
 */
export default class NullViewport extends Container implements Service
{
    /** The name of the service instance. */
    public override name = 'NullViewport';

    /** Unique identifier used by the Locator to recognize this service. */
    public readonly serviceType = 'viewport';

    /** Does nothing. This is a no-op placeholder. */
    resize(): void
    {
    // No operation
    }

    /** Returns 1.0 as the default crop width ratio (no cropping). */
    get cropWidthRatio(): number
    {
        return 1.0;
    }

    /** Returns 1.0 as default width ratio. */
    get widthRatio(): number
    {
        return 1.0;
    }

    /** Returns 1.0 as default height ratio. */
    get heightRatio(): number
    {
        return 1.0;
    }

    /** Returns 0 as default left boundary. */
    get left(): number
    {
        return 0;
    }

    /** Returns 0 as default right boundary. */
    get right(): number
    {
        return 0;
    }

    /** Always returns true as a neutral default for orientation check. */
    isLandscape(): boolean
    {
        return true;
    }

    /** Cleans up any listeners or resources. No-op in null implementation. */
    dispose(): void
    {
        this.destroy({ children: true, texture: false, baseTexture: false });
    }
}
