import * as google_gax from 'google-gax';
import { ClientOptions } from 'google-gax';
import * as _google_cloud_cloudbuild_build_protos_protos_js from '@google-cloud/cloudbuild/build/protos/protos.js';
import * as _google_cloud_cloudbuild_build_src_v1_cloud_build_client_js from '@google-cloud/cloudbuild/build/src/v1/cloud_build_client.js';
import * as google_auth_library_build_src_auth_googleauth from 'google-auth-library/build/src/auth/googleauth';
import { GoogleAuth } from 'google-auth-library';
import * as _google_cloud_run_build_protos_protos_js from '@google-cloud/run/build/protos/protos.js';
import { v2 } from '@google-cloud/run';
import { google } from '@google-cloud/cloudbuild/build/protos/protos';

declare type AuthInfo = {
    type: 'service_account';
    project_id: string;
    private_key: string;
    private_key_id: string;
    client_email: string;
    client_id: string;
    auth_uri: string;
    token_uri: string;
    auth_provider_x509_cert_url: string;
    client_x509_cert_url: string;
};
declare const createAuth: (info: AuthInfo) => GoogleAuth<google_auth_library_build_src_auth_googleauth.JSONClient>;
declare const getProjectId: (owner: string, repoName: string) => string;
declare const getCloudBuildTriggerName: (owner: string, repoName: string) => string;
declare const getCloudRunServiceName: (owner: string, repoName: string) => string;
declare type GoogleClientConfig = Pick<ClientOptions, 'projectId'> & {
    auth?: AuthInfo;
};

interface CloudBuildConfig extends GoogleClientConfig {
}
declare function createCloudBuild(config: CloudBuildConfig): {
    readonly _client: _google_cloud_cloudbuild_build_src_v1_cloud_build_client_js.CloudBuildClient;
    readonly createBuildTrigger: (owner: string, repoName: string) => Promise<_google_cloud_cloudbuild_build_protos_protos_js.google.devtools.cloudbuild.v1.IBuildTrigger>;
    readonly runBuildTrigger: (owner: string, repoName: string) => Promise<google_gax.LROperation<_google_cloud_cloudbuild_build_protos_protos_js.google.devtools.cloudbuild.v1.IBuild, _google_cloud_cloudbuild_build_protos_protos_js.google.devtools.cloudbuild.v1.IBuildOperationMetadata>>;
};

declare function createCloudRun(config: CloudBuildConfig): {
    readonly _client: v2.ServicesClient;
    readonly getCloudRunService: (owner: string, repoName: string) => Promise<_google_cloud_run_build_protos_protos_js.google.cloud.run.v2.IService>;
    readonly getCloudRunServiceURL: (owner: string, repoName: string) => Promise<string | null | undefined>;
    readonly createCloudRun: (owner: string, repoName: string) => Promise<void>;
};

/**
 * Documents:
 *  - Schema: https://cloud.google.com/build/docs/build-config-file-schema
 *  - Substitution variables: https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values
 */

declare const createFunixBuildSteps: (repoId: string, cloudRunServiceName: string, _config?: {}) => google.devtools.cloudbuild.v1.IBuild;

export { AuthInfo, CloudBuildConfig, GoogleClientConfig, createAuth, createCloudBuild, createCloudRun, createFunixBuildSteps, getCloudBuildTriggerName, getCloudRunServiceName, getProjectId };
