/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */

import type { AssetData } from "metro";

declare export function cleanAssetCatalog(catalogDir: string): void;

type ImageSet = {
  basePath: string,
  files: { name: string, src: string, scale: number }[],
};

type CatalogImage = { scale: number, src: string };

/**
 * Pairs each catalog-valid scale of the asset with its source file.
 *
 * If the asset has no valid scale at all (e.g. only a fractional @1.5x
 * variant), its closest variant is mapped into the nearest valid slot,
 * mirroring the "closest larger" fallback filterPlatformAssetScales applies
 * to loose files, so the imageset always contains at least one rendition
 * actool will compile.
 */
declare export function getCatalogImages(asset: AssetData): Array<CatalogImage>;

declare export function getImageSet(
  catalogDir: string,
  asset: AssetData,
): ImageSet;

declare export function isCatalogAsset(asset: AssetData): boolean;

declare export function writeImageSet(imageSet: ImageSet): void;
