import type { ProjectsRoute } from "../routes.js";
import type { Agent, CreateWorkspaceInput, ProjectTransport, Recipe, Root, UpdateWorkspaceInput, Workspace, WorkspaceAgentAssignment, WorkspaceEvent, WorkspaceKind, WorkspaceLocation, WorkspaceStatus } from "../../tui/types.js";
/** Which statuses the list filter offers. `"all"` shows everything. */
export type ProjectsStatusFilter = WorkspaceStatus | "all";
export interface ProjectsFilter {
    status: ProjectsStatusFilter;
    kind: WorkspaceKind | "all";
    query: string;
}
export type ProjectsDialog = {
    kind: "create";
} | {
    kind: "edit";
    project: Workspace;
} | {
    kind: "confirm-archive";
    project: Workspace;
} | {
    kind: "confirm-unarchive";
    project: Workspace;
} | {
    kind: "confirm-delete";
    project: Workspace;
    hard?: boolean;
} | {
    kind: "shortcuts";
} | {
    kind: "settings";
};
export interface ProjectsViewState {
    route: ProjectsRoute;
    /** Every project matching the current filter (list route). */
    projects: Workspace[];
    loading: boolean;
    /** Last fetch/mutation error; views render it as a banner or empty state. */
    error: string | null;
    filter: ProjectsFilter;
    /** The project open in the detail route. */
    selected: Workspace | null;
    selectedLoading: boolean;
    /** Detail-route side data, loaded alongside `selected`. */
    events: WorkspaceEvent[];
    locations: WorkspaceLocation[];
    assignments: WorkspaceAgentAssignment[];
    roots: Root[];
    recipes: Recipe[];
    agents: Agent[];
    /** Which registry transport the store seam resolved (null until first load). */
    transport: ProjectTransport | null;
    /** Human-readable authority host for http, or null for local. */
    authority: string | null;
    dialog: ProjectsDialog | null;
    /** True while any mutation is in flight (buttons show busy state). */
    mutating: boolean;
}
export interface ProjectsActions {
    /** (Re)load the project list and the shared registries. */
    load(): Promise<void>;
    /** Reload the project list only (after filters change or a mutation). */
    reloadProjects(): Promise<void>;
    setFilter(partial: Partial<ProjectsFilter>): void;
    navigate(route: ProjectsRoute): Promise<void>;
    /** Open the detail route and load the project + side data. */
    openProject(idOrSlug: string): Promise<void>;
    /** Reload the open detail project and its side data. */
    refreshSelected(): Promise<void>;
    openDialog(dialog: ProjectsDialog): void;
    closeDialog(): void;
    /** Returns the created project, or null when the user cancelled/errored. */
    createProject(input: CreateWorkspaceInput): Promise<Workspace | null>;
    /** Returns the updated project, or null on cancellation/error. */
    updateProject(id: string, patch: UpdateWorkspaceInput): Promise<Workspace | null>;
    archiveProject(id: string): Promise<boolean>;
    unarchiveProject(id: string): Promise<boolean>;
    deleteProject(id: string, hard?: boolean): Promise<boolean>;
}
export interface ProjectsContextValue {
    state: ProjectsViewState;
    actions: ProjectsActions;
}
//# sourceMappingURL=state-contract.d.ts.map