import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';

/**
 * Shared types for GitHub Workflows plugin
 * @public
 */
interface GithubFileResponse {
    type: 'dir' | 'file' | 'submodule' | 'symlink';
    encoding: string;
    size: number;
    name: string;
    path: string;
    content: string;
    sha: string;
    url: string;
    git_url: string;
    html_url: string;
    download_url: string;
    _links: {
        git: string;
        self: string;
        html: string;
    };
}
interface WorkflowDispatchParameters {
    name: string;
    description: string;
    default: string;
    required: boolean;
    type: string;
    options?: string[];
}
interface Workflows {
    workflow: {
        id: number;
        name: string;
        state: string;
        url: string;
        path: string;
        createdAt: string;
        updatedAt: string;
    };
    latestRun: {
        id?: number;
        status?: string;
        conclusion?: string;
    };
    parameters: WorkflowDispatchParameters[];
}
interface Branch {
    name: string;
    commit?: {
        sha: string;
        url: string;
    };
    protected: boolean;
}
interface JobsResponse {
    total_count: number;
    jobs: Job[];
}
interface Job {
    id: number;
    name: string;
    status: string;
    conclusion?: string;
    started_at: string;
    completed_at?: string;
    html_url?: string;
    steps?: Step[];
}
interface Step {
    name: string;
    status: string;
    conclusion?: string;
    number: number;
    started_at?: string;
    completed_at?: string;
}
interface WorkflowRun {
    id: number;
    name: string;
    head_branch: string;
    event: string;
    status: string;
    conclusion?: string;
    run_started_at: string;
    created_at: string;
    updated_at: string;
    actor?: {
        id: number;
        login: string;
        avatar_url: string;
    };
    path?: string;
    artifacts_url?: string;
    head_sha?: string;
    repository?: {
        id: number;
        name: string;
        full_name: string;
    };
}
interface EnvironmentsResponse {
    total_count: number;
    environments: Environment[];
}
interface Environment {
    id: number;
    name: string;
    node_id: string;
    protection_rules?: any[];
    deployment_branch_policy?: any;
}
interface Workflow {
    id: number;
    nodeId: string;
    name: string;
    path: string;
    state: string;
    createdAt: string;
    updatedAt: string;
    url: string;
    html_url: string;
    badgeUrl: string;
}
interface WorkflowResponseFromApi {
    total_count: number;
    workflows: Workflow[];
}
interface WorkflowRunsResponseFromApi {
    total_count: number;
    workflow_runs: WorkflowRun[];
}
interface WorkflowResultsProps {
    id?: number;
    name?: string;
    lastRunId?: number;
    status?: string;
    conclusion?: string;
    source?: string;
    path?: string;
    parameters?: WorkflowDispatchParameters[] | [];
}
interface Actor {
    id: number;
    login: string;
    avatar_url: string;
}
interface Repository {
    id: number;
    name: string;
    full_name: string;
}
interface Commit {
    sha: string;
    url: string;
}
interface Protection {
    required_status_checks: {
        enforcement_level: string;
        contexts: string[];
    };
}
interface WorkflowAnnotation {
    workflow: string;
    label?: string;
    tooltip?: string;
}

declare const githubWorkflowsApiRef: _backstage_core_plugin_api.ApiRef<GithubWorkflowsApi>;
interface GithubWorkflowsApi {
    listWorkflows(hostname: string, githubRepoSlug: string, branch: string, filter?: string[]): Promise<Workflows[]>;
    listBranchesFromRepo(hostname: string, githubRepoSlug: string): Promise<Branch[]>;
    getBranchDefaultFromRepo(hostname: string, githubRepoSlug: string): Promise<string>;
    startWorkflowRun(hostname: string, githubRepoSlug: string, workflowId: number, branch: string, inputs?: {
        [key: string]: unknown;
    }): Promise<number>;
    stopWorkflowRun(hostname: string, githubRepoSlug: string, runId: number): Promise<number>;
    listJobsForWorkflowRun(hostname: string, githubRepoSlug: string, id: number, pageSize?: number, page?: number): Promise<JobsResponse>;
    getWorkflowRunById(hostname: string, githubRepoSlug: string, runId: number): Promise<WorkflowRun>;
    downloadJobLogsForWorkflowRun(hostname: string, githubRepoSlug: string, jobId: number): Promise<string>;
    getEnvironmentsList(hostname: string, githubRepoSlug: string): Promise<EnvironmentsResponse>;
}

export { githubWorkflowsApiRef };
export type { Actor, Branch, Commit, Environment, EnvironmentsResponse, GithubFileResponse, GithubWorkflowsApi, Job, JobsResponse, Protection, Repository, Step, Workflow, WorkflowAnnotation, WorkflowDispatchParameters, WorkflowResponseFromApi, WorkflowResultsProps, WorkflowRun, WorkflowRunsResponseFromApi, Workflows };
