"use strict";
// import { IClientForImageRegistry } from './i-client-for-image-registry';
// import { ImageTagList } from './docker-registry-api-client/entities/image-tag-list';
// import { SingleResult, CodiacError } from '@codiac.io/codiac-common/contracts';
// /** Determines if the registry client should be invoked for images with the given registry url. */
// export type RegistryClientMapping = {
//   appliesTo: (registryUrl: string) => boolean;
//   create: (...args: any[]) => IClientForImageRegistry;
// }
// /** One-stop-shop for image registry operations.
//  * Contains an inner factory for clients for any declared image registries.
//  * We'd just call this class a registry itself but since it's for registry clients, 
//  * that nomenclature would just get confusing.
//  * And besides, since it's for a CLI, it's doing JIT/on-demand instantiation, 
//  * instead of true IOC (because we have to bootstrap for each command, 
//  * we dont want to make the user wait for unnecessary bootstrapping steps). 
//  */
// export class CompositeImageRegistryClient /* implements IClientForImageRegistry */ {
//   /**
//    * @param appliesTo 
//    * @param factoryMethod  
//    */
//   public static registerClient<TClient extends IClientForImageRegistry>(
//     appliesTo: (registryUrl: string) => boolean,
//     factoryMethod: (registryUrl: string) => TClient): void {
//     let mapping: RegistryClientMapping = {
//       appliesTo: appliesTo,
//       create: factoryMethod
//     };
//     this.clientMap.push(mapping);
//   }
//   /** Throws when no registered clients support the rgistry url. */
//   public static createFor(registryUrl: string): IClientForImageRegistry {
//     let client: IClientForImageRegistry | undefined;
//     for (let factory of this.clientMap) {
//       if (factory.appliesTo(registryUrl)) {
//         client = factory.create(registryUrl);
//         break;
//       }
//     }
//     if (!client) throw new CodiacError(`No image registry client has been declared that supports the registry ${registryUrl}.`);
//     return client;
//   }
//   private static clientMap: RegistryClientMapping[] = [];
//   /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
//   *   _____          _                         ___  ___               _                   
//   *  |_   _|        | |                        |  \/  |              | |                  
//   *    | | _ __  ___| |_ __ _ _ __   ___ ___   | .  . | ___ _ __ ___ | |__   ___ _ __ ___ 
//   *    | || '_ \/ __| __/ _` | '_ \ / __/ _ \  | |\/| |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ __|
//   *   _| || | | \__ \ || (_| | | | | (_|  __/  | |  | |  __/ | | | | | |_) |  __/ |  \__ \
//   *   \___/_| |_|___/\__\__,_|_| |_|\___\___|  \_|  |_/\___|_| |_| |_|_.__/ \___|_|  |___/
//   *                                                                                   
//   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//   constructor() {
//   }
//   /** Success-or-throw.  Throws on any unsuccessful scenario.  */
//   public async push(registryDomainName: string, scopedImageName: string, tag: string): Promise<void> {
//     let client = CompositeImageRegistryClient.createFor(registryDomainName);
//     return client.push(registryDomainName, scopedImageName, tag);
//   }
//   tryGetImageTags(registryDomainName: string, scopedImageName: string): Promise<SingleResult<ImageTagList>> {
//     let client = CompositeImageRegistryClient.createFor(registryDomainName);
//     return client.tryGetImageTags(scopedImageName);
//   }
//   /** Uses the client for the given registry with the credentials store 
//    * to ensure that the local instance has access to the given registry.
//    * Returns false for invalid creds (http 401 and 403s).
//    * Throws any encountered exceptions.  */
//   public async authenticate(registryDomainName: string, secret: string, username?: string): Promise<boolean> {
//     let client = CompositeImageRegistryClient.createFor(registryDomainName);
//     return client.authenticate(registryDomainName, secret, username);
//   }
// }
//# sourceMappingURL=composite-image-registry-client.js.map