export interface QueryContext {
  actorId: string;
  permissions?: readonly string[];
  companyId?: string | null;
}

export interface CommandContext {
  actorId: string;
  permissions: readonly string[];
  companyId?: string | null;
}

// Strips write methods (updateTable, insertInto, deleteFrom) from a Kysely DB instance.
// Query handlers use this instead of the full DB type to get compile-time write prevention.
export type ReadonlyDB<T extends { selectFrom: unknown }> = Pick<T, "selectFrom">;

export interface PaginationInput<TOrderBy extends string = never> {
  limit?: number;
  offset?: number;
  orderBy?: "id" | TOrderBy;
  orderDirection?: "asc" | "desc";
}

export interface PaginatedResult<T> {
  items: T[];
  total?: number;
  hasNextPage: boolean;
}
