from __future__ import annotations

from pathlib import Path

from one_run.manifest import load_manifest
from one_run.templating import validate_placeholders


def validate_manifest(config_path: str) -> int:
    manifest_path = Path(config_path).resolve()
    manifest = load_manifest(manifest_path)
    validate_placeholders(manifest.entrypoint.command)

    print(f"manifest={manifest_path}")
    print("valid=true")
    print(f"backend={manifest.backend.kind}")
    print(f"environment={manifest.environment.kind}")
    return 0
