import type { Db } from "@rudderhq/db";
import { projects } from "@rudderhq/db";
import { type CreateProjectInlineResourceInput, type ProjectCodebase, type ProjectExecutionWorkspacePolicy, type ProjectGoalRef, type ProjectResourceAttachment, type ProjectResourceAttachmentInput, type ProjectWorkspace } from "@rudderhq/shared";
type ProjectRow = typeof projects.$inferSelect;
type CreateWorkspaceInput = {
    name?: string | null;
    sourceType?: string | null;
    cwd?: string | null;
    repoUrl?: string | null;
    repoRef?: string | null;
    defaultRef?: string | null;
    visibility?: string | null;
    setupCommand?: string | null;
    cleanupCommand?: string | null;
    remoteProvider?: string | null;
    remoteWorkspaceRef?: string | null;
    sharedWorkspaceKey?: string | null;
    metadata?: Record<string, unknown> | null;
    isPrimary?: boolean;
};
type UpdateWorkspaceInput = Partial<CreateWorkspaceInput>;
interface ProjectWithGoals extends Omit<ProjectRow, "executionWorkspacePolicy"> {
    urlKey: string;
    goalIds: string[];
    goals: ProjectGoalRef[];
    executionWorkspacePolicy: ProjectExecutionWorkspacePolicy | null;
    codebase: ProjectCodebase;
    resources: ProjectResourceAttachment[];
    workspaces: ProjectWorkspace[];
    primaryWorkspace: ProjectWorkspace | null;
}
interface ProjectShortnameRow {
    id: string;
    name: string;
}
interface ResolveProjectNameOptions {
    excludeProjectId?: string | null;
}
export declare function resolveProjectNameForUniqueShortname(requestedName: string, existingProjects: ProjectShortnameRow[], options?: ResolveProjectNameOptions): string;
export declare function projectService(db: Db): {
    list: (orgId: string) => Promise<ProjectWithGoals[]>;
    listByIds: (orgId: string, ids: string[]) => Promise<ProjectWithGoals[]>;
    getById: (id: string) => Promise<ProjectWithGoals | null>;
    create: (orgId: string, data: Omit<typeof projects.$inferInsert, "orgId"> & {
        goalIds?: string[];
        resourceAttachments?: ProjectResourceAttachmentInput[];
        newResources?: CreateProjectInlineResourceInput[];
    }) => Promise<ProjectWithGoals>;
    update: (id: string, data: Partial<typeof projects.$inferInsert> & {
        goalIds?: string[];
        resourceAttachments?: ProjectResourceAttachmentInput[];
        newResources?: CreateProjectInlineResourceInput[];
    }) => Promise<ProjectWithGoals | null>;
    remove: (id: string) => Promise<{
        icon: string;
        urlKey: string;
        id: string;
        orgId: string;
        description: string | null;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        name: string;
        goalId: string | null;
        targetDate: string | null;
        color: string | null;
        executionWorkspacePolicy: Record<string, unknown> | null;
        leadAgentId: string | null;
        archivedAt: Date | null;
        pauseReason: string | null;
        pausedAt: Date | null;
    } | null>;
    listWorkspaces: (projectId: string) => Promise<ProjectWorkspace[]>;
    createWorkspace: (projectId: string, data: CreateWorkspaceInput) => Promise<ProjectWorkspace | null>;
    updateWorkspace: (projectId: string, workspaceId: string, data: UpdateWorkspaceInput) => Promise<ProjectWorkspace | null>;
    removeWorkspace: (projectId: string, workspaceId: string) => Promise<ProjectWorkspace | null>;
    resolveByReference: (orgId: string, reference: string) => Promise<{
        readonly project: null;
        readonly ambiguous: false;
    } | {
        readonly project: {
            readonly id: string;
            readonly orgId: string;
            readonly urlKey: string;
        };
        readonly ambiguous: false;
    } | {
        readonly project: null;
        readonly ambiguous: true;
    }>;
};
export {};
//# sourceMappingURL=projects.d.ts.map