import type { Deployment } from '../../../../api/queries/admin/apps';

export function instanceIdsFor(
  deployment: Pick<Deployment, 'id' | 'replicaStates'>,
  envSlug: string,
  appSlug: string,
): string[] {
  const generation = deployment.id.replace(/-/g, '').slice(0, 8);
  return deployment.replicaStates.map((r) =>
    `${envSlug}-${appSlug}-${r.index}-${generation}`
  );
}
