import type { PageState } from "../../components/common/cursorPaging";

export interface RepositoryBrowserState {
  selectedRepoId: string | null;
  selectedPpId: string | null;
  repoFilter: string;
  ppFilter: string;
  objectFilter: string;
  repoPage: PageState;
  ppPage: PageState;
  objectPage: PageState;
  isRepoPanelCollapsed: boolean;
  isPpPanelCollapsed: boolean;
}

export function createRepositoryBrowserState(): RepositoryBrowserState {
  return {
    selectedRepoId: null,
    selectedPpId: null,
    repoFilter: "",
    ppFilter: "",
    objectFilter: "",
    repoPage: createEmptyPageState(),
    ppPage: createEmptyPageState(),
    objectPage: createEmptyPageState(),
    isRepoPanelCollapsed: false,
    isPpPanelCollapsed: false
  };
}

export function createEmptyPageState(): PageState {
  return { cursor: null, previous: [] };
}
