import { type AppSurface, type AppType, type AppHostingMode, type AppAuthMode, type AppControllerMode, type AppVersionVisibility, type AppAchievementCatalogueDefinition, type AppLeaderboardCatalogueDefinition, type PlayerMetaDefinitionStatus, type CatalogueTagGroupDefinition, type AppMetadataAssetSpecSupport, type AssetSpecContract, type AssetSpecStatus, type AssetSpecValidationKind, type ContentLicense } from '@playdrop/types';
import { type AssetSpecSupportDeclaration } from './assetSpecs';
export type CatalogueJson = {
    apps?: Array<Record<string, unknown>>;
    tagGroups?: CatalogueTagGroupDefinition[];
    assetSpecs?: Array<Record<string, unknown>>;
    assets?: Array<Record<string, unknown>>;
    assetPacks?: Array<Record<string, unknown>>;
} & Record<string, unknown>;
/**
 * Listing assets configuration for an app version.
 * All paths are relative to the catalogue.json directory.
 */
export type AppListingConfig = {
    icon?: string;
    heroPortrait?: string;
    heroLandscape?: string;
    screenshotsPortrait?: string[];
    screenshotsLandscape?: string[];
    videosPortrait?: string[];
    videosLandscape?: string[];
};
export type ResolvedAppAchievementDefinition = Omit<AppAchievementCatalogueDefinition, 'status'> & {
    iconPath: string;
    status: PlayerMetaDefinitionStatus;
};
export type ResolvedAppLeaderboardDefinition = Omit<AppLeaderboardCatalogueDefinition, 'status'> & {
    status: PlayerMetaDefinitionStatus;
};
export type AppCatalogueEntry = {
    name: string;
    displayName?: string;
    description?: string;
    file?: string;
    ecs?: string;
    server?: string;
    type?: string;
    emoji?: string | null;
    color?: string | null;
    templateSource?: string | null;
    remixSource?: string | null;
    remix?: string;
    surfaceTargets?: Record<string, unknown> | AppSurface[] | null;
    version?: string;
    releaseNotes?: string;
    visibility?: string;
    license?: string;
    hostingMode?: string;
    authMode?: string;
    controllerMode?: string;
    previewable?: boolean;
    externalUrl?: string;
    listing?: AppListingConfig;
    username?: string;
    achievements?: AppAchievementCatalogueDefinition[];
    leaderboards?: AppLeaderboardCatalogueDefinition[];
    ownedAssets?: OwnedAssetCatalogueEntry[];
    assetSpecSupport?: AppMetadataAssetSpecSupport[];
    uses?: {
        assets?: string[];
        packs?: string[];
    };
    tags?: string[];
    relations?: Array<{
        type: string;
        to: string;
    }>;
};
export type AssetCatalogueEntry = {
    name: string;
    displayName?: string;
    category?: string;
    subcategory?: string;
    format?: string;
    assetSpec?: string;
    remix?: string;
    username?: string;
    files?: Record<string, string>;
    visibility?: string;
    license?: string;
    tags?: string[];
    shopListed?: boolean;
    shopPriceCredits?: number;
    relations?: Array<{
        type: string;
        to: string;
    }>;
};
export type AssetSpecCatalogueEntry = {
    name: string;
    version?: string;
    displayName?: string;
    description?: string;
    symbol?: string;
    contract?: string;
    documentation?: string;
    visibility?: string;
    validationKind?: string;
    status?: string;
    releaseNotes?: string;
    successorVersion?: string;
    username?: string;
};
export type OwnedAssetCatalogueEntry = {
    name: string;
    runtimeKey?: string;
    displayName?: string;
    description?: string;
    category?: string;
    subcategory?: string;
    format?: string;
    files?: Record<string, string>;
    visibility?: string;
    license?: string;
    tags?: string[];
    shopListed?: boolean;
    shopPriceCredits?: number;
};
export type AssetPackCatalogueEntry = {
    name: string;
    version?: string;
    remix?: string;
    username?: string;
    assets?: string[];
    ownedAssets?: OwnedAssetCatalogueEntry[];
    hostingMode?: string;
    externalUrl?: string;
    downloadUrl?: string;
    visibility?: string;
    license?: string;
    releaseNotes?: string;
    listing?: AppListingConfig;
    tags?: string[];
    relations?: Array<{
        type: string;
        to: string;
    }>;
};
export type CatalogueFile = {
    absolutePath: string;
    relativePath: string;
    directory: string;
    data: CatalogueJson;
};
/**
 * Resolved listing asset paths (absolute paths).
 */
export type ResolvedListingAssets = {
    iconPath?: string;
    heroPortraitPath?: string;
    heroLandscapePath?: string;
    screenshotPortraitPaths: string[];
    screenshotLandscapePaths: string[];
    videoPortraitPaths: string[];
    videoLandscapePaths: string[];
};
export type AppDependencyAssetRef = {
    ref: string;
    runtimeKey?: string;
};
export type AppTask = {
    kind: 'app';
    name: string;
    cataloguePath: string;
    catalogueAbsolutePath: string;
    catalogueDir: string;
    filePath: string;
    relativeFile: string;
    projectDir: string;
    packageJsonPath: string | null;
    isTypescriptProject: boolean;
    hasValidateScript: boolean;
    hasFormatScript: boolean;
    displayName?: string;
    description?: string;
    type?: AppType;
    emoji?: string | null;
    color?: string | null;
    surfaceTargets: AppSurface[];
    missingMetadata: string[];
    ecsPath?: string;
    serverPath?: string;
    version?: string;
    releaseNotes?: string;
    versionVisibility?: AppVersionVisibility;
    license: ContentLicense;
    tags: string[];
    hostingMode?: AppHostingMode;
    authMode?: AppAuthMode;
    controllerMode?: AppControllerMode;
    previewable?: boolean;
    externalUrl?: string;
    listing?: ResolvedListingAssets;
    username?: string;
    achievements: ResolvedAppAchievementDefinition[];
    leaderboards: ResolvedAppLeaderboardDefinition[];
    remix?: string;
    ownedAssets: OwnedAssetTask[];
    assetSpecSupport: AssetSpecSupportDeclaration[];
    uses: {
        assets: AppDependencyAssetRef[];
        packs: string[];
    };
    graph: {
        relations: Array<{
            type: string;
            to: string;
        }>;
    };
};
export type AssetTask = {
    kind: 'asset';
    name: string;
    displayName?: string;
    cataloguePath: string;
    category?: string;
    subcategory?: string | null;
    assetSpec?: string;
    username?: string;
    remix?: string;
    format?: string;
    visibility?: string;
    license: ContentLicense;
    tags: string[];
    shopListed?: boolean;
    shopPriceCredits?: number;
    files: Record<string, string>;
    filePaths: Record<string, string>;
    assetSpecContract?: AssetSpecContract;
    relations?: Array<{
        type: string;
        to: string;
    }>;
};
export type AssetSpecTask = {
    kind: 'asset-spec';
    name: string;
    version: string;
    displayName: string;
    description?: string;
    cataloguePath: string;
    catalogueAbsolutePath: string;
    catalogueDir: string;
    username?: string;
    visibility?: 'PUBLIC' | 'PRIVATE';
    validationKind: AssetSpecValidationKind;
    status: AssetSpecStatus;
    releaseNotes?: string;
    successorVersion?: string;
    symbolPath: string;
    contractPath: string;
    documentationPath?: string;
    contract: AssetSpecContract;
};
export type OwnedAssetTask = {
    kind: 'owned-asset';
    appName: string;
    name: string;
    runtimeKey?: string;
    displayName?: string;
    description?: string;
    cataloguePath: string;
    category: string;
    subcategory: string | null;
    assetSpec?: string;
    assetSpecContract?: AssetSpecContract;
    format?: string;
    visibility?: string;
    license: ContentLicense;
    tags: string[];
    shopListed?: boolean;
    shopPriceCredits?: number;
    files: Record<string, string>;
    filePaths: Record<string, string>;
};
export type PackOwnedAssetTask = {
    name: string;
    cataloguePath: string;
    displayName?: string;
    description?: string;
    category: string;
    subcategory: string | null;
    assetSpec?: string;
    assetSpecContract?: AssetSpecContract;
    format?: string;
    visibility?: string;
    license: ContentLicense;
    tags: string[];
    shopListed?: boolean;
    shopPriceCredits?: number;
    files: Record<string, string>;
    filePaths: Record<string, string>;
};
export type AssetPackTask = {
    kind: 'asset-pack';
    name: string;
    displayName?: string;
    version: string;
    cataloguePath: string;
    username?: string;
    remix?: string;
    assets: string[];
    ownedAssets: PackOwnedAssetTask[];
    tags: string[];
    hostingMode?: AppHostingMode;
    externalUrl?: string;
    downloadUrl?: string;
    visibility?: string;
    license: ContentLicense;
    releaseNotes?: string;
    listing?: ResolvedListingAssets;
    relations?: Array<{
        type: string;
        to: string;
    }>;
};
export type CatalogueLoadOptions = {
    filterName?: string;
    filterFile?: string;
};
export type CatalogueLoadResult = {
    apps: AppTask[];
    assetSpecs: AssetSpecTask[];
    assets: AssetTask[];
    ownedAssets: OwnedAssetTask[];
    assetPacks: AssetPackTask[];
    warnings: string[];
    errors: string[];
};
export type CatalogueTagGroupsLoadResult = {
    groups: CatalogueTagGroupDefinition[];
    errors: string[];
};
export type SurfaceTargetsMap = {
    desktop: boolean;
    mobileLandscape: boolean;
    mobilePortrait: boolean;
};
export type ValidatedAppMetadata = {
    displayName?: string;
    description?: string;
    type?: AppType;
    emoji?: string | null;
    color?: string | null;
    surfaceTargets: AppSurface[];
    surfaceTargetMap: SurfaceTargetsMap;
    missingFields: string[];
    warnings: string[];
    errors: string[];
};
type WorkspaceResolution = {
    kind: 'app';
    task: AppTask;
    warnings: string[];
} | {
    kind: 'file';
    htmlPath: string;
} | {
    kind: 'directory';
    cataloguePath: string;
} | {
    kind: 'not_found';
    reason: 'catalogue_missing' | 'multiple_apps' | 'app_missing' | 'no_apps';
    message: string;
};
export type WorkspaceAppResolution = WorkspaceResolution;
export type WorkspaceAppLookup = {
    cwd: string;
    target?: string;
    appName?: string | null;
};
export declare function validateAppMetadata(entry: AppCatalogueEntry): ValidatedAppMetadata;
export declare function resolveCatalogueTagGroups(rootDir: string): CatalogueTagGroupsLoadResult;
export declare function resolveCatalogueEntries(rootDir: string, options?: CatalogueLoadOptions): CatalogueLoadResult;
export declare function resolveWorkspaceApp(options: WorkspaceAppLookup): WorkspaceAppResolution;
export declare function formatMetadataWarnings(warnings: string[]): Set<string>;
export declare function formatMissingMetadataWarnings(task: {
    cataloguePath: string;
    missingMetadata: string[];
}): string | undefined;
export declare function findAppTaskByFile(htmlPath: string): {
    task?: AppTask;
    warnings: string[];
    errors: string[];
};
export {};
