import type { Database } from "bun:sqlite"; import type { ApiPrincipal } from "./types.js"; import type { SkillProfile, SkillSelection, StationSkillState, StationSkillStateInput } from "../types/skill-selection.js"; export interface SkillSelectionStore { profilesReferencingSkill(principal: ApiPrincipal, slug: string): Promise; getProfile(principal: ApiPrincipal, id: string): Promise; /** null expected revision means create-only; null result means CAS conflict. */ saveProfile(principal: ApiPrincipal, id: string, selections: SkillSelection[], expected: string | null): Promise; getStationState(principal: ApiPrincipal, id: string): Promise; /** Refuses an obsolete profile revision atomically with storing the receipt. */ saveStationState(principal: ApiPrincipal, id: string, input: StationSkillStateInput): Promise; } type Row = Record; export declare class MemorySkillSelectionStore implements SkillSelectionStore { private profiles; private states; private key; getProfile(p: ApiPrincipal, id: string): Promise; profilesReferencingSkill(p: ApiPrincipal, slug: string): Promise; saveProfile(p: ApiPrincipal, id: string, selected: SkillSelection[], expected: string | null): Promise; getStationState(p: ApiPrincipal, id: string): Promise; saveStationState(p: ApiPrincipal, id: string, input: StationSkillStateInput): Promise; } export declare class SqliteSkillSelectionStore implements SkillSelectionStore { private db; constructor(db: Database); profilesReferencingSkill(p: ApiPrincipal, slug: string): Promise; getProfile(p: ApiPrincipal, id: string): Promise; saveProfile(p: ApiPrincipal, id: string, selected: SkillSelection[], expected: string | null): Promise; getStationState(p: ApiPrincipal, id: string): Promise; saveStationState(p: ApiPrincipal, id: string, input: StationSkillStateInput): Promise; } type Sql = (strings: TemplateStringsArray, ...values: unknown[]) => Promise; type SqlTransaction = Sql; interface SqlWithTransaction extends Sql { begin(fn: (tx: SqlTransaction) => Promise): Promise; } export declare class PostgresSkillSelectionStore implements SkillSelectionStore { private sql; constructor(sql: SqlWithTransaction); profilesReferencingSkill(p: ApiPrincipal, slug: string): Promise; getProfile(p: ApiPrincipal, id: string): Promise; saveProfile(p: ApiPrincipal, id: string, selected: SkillSelection[], expected: string | null): Promise; getStationState(p: ApiPrincipal, id: string): Promise; saveStationState(p: ApiPrincipal, id: string, input: StationSkillStateInput): Promise; } export {};