<?php
declare(strict_types=1);

namespace Ekesto\CacheInvalidator\Integrations\Structural\Providers\Contracts;

use Ekesto\CacheInvalidator\Integrations\Structural\Core\StructuralContainerResolution;

/**
 * Shared contract for structural container providers.
 */
interface StructuralContainerProviderInterface
{
    /**
     * Return the provider key.
     *
     * @return string
     */
    public function key(): string;

    /**
     * Return structural post types classified by this provider.
     *
     * @return string[]
     */
    public function structuralPostTypes(): array;

    /**
     * Determine whether this provider owns the provided post.
     *
     * @param \WP_Post $post Post object.
     * @return bool
     */
    public function supports(\WP_Post $post): bool;

    /**
     * Resolve one provider-owned usage step for the provided structural entity.
     *
     * @param int $postId Structural entity ID.
     * @return StructuralContainerResolution
     */
    public function resolveUsage(int $postId): StructuralContainerResolution;
}
