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

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

import type { Kysely } from "@tailor-platform/sdk/kysely";

// 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.
// Without a type parameter, defaults to any Kysely instance (used by Query type and cross-module interfaces).
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ReadonlyDB<T extends { selectFrom: unknown } = Kysely<any>> = 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;
}
