import type { Json } from "atom.io/foundations/json"
import { MapOverlay, SetOverlay } from "atom.io/foundations/overlays"
import { RelationsOverlay } from "./relations-overlay.ts"
export type Refinement = (a: A) => a is B
export type JunctionEntriesBase<
A extends string,
B extends string,
Content extends Json.Object | null,
> = {
readonly relations: ([A, B[]] | [B, A[]])[]
readonly contents: [string, Content][]
}
export interface JunctionEntries<
A extends string,
B extends string,
Content extends Json.Object | null,
>
extends Json.Object, JunctionEntriesBase {}
export type JunctionSchemaBase = {
/** Description of the relationship between the two sides */
readonly between: [a: AName, b: BName]
/** How many relations are allowed in each direction? */
readonly cardinality: `1:1` | `1:n` | `n:n`
}
export interface JunctionSchema