// This file was generated by [rspc](https://github.com/oscartbeaumont/rspc). Do not edit this file manually.

export type Procedures = {
	queries:
		| { key: 'db.tags'; input: string; result: Record<string, Tag> }
		| { key: 'dbs'; input: string; result: Array<string> }
		| { key: 'file_path.list'; input: string; result: Array<FilePath> }
		| { key: 'message.list'; input: string; result: Array<CRDTOperation> }
		| { key: 'operations'; input: string; result: Array<CRDTOperation> };
	mutations:
		| { key: 'createDatabase'; input: string; result: string }
		| { key: 'file_path.create'; input: string; result: FilePath }
		| { key: 'pullOperations'; input: string; result: null }
		| { key: 'removeDatabases'; input: string; result: null }
		| { key: 'testCreate'; input: string; result: null };
	subscriptions: never;
};

export interface CRDTOperation {
	node: string;
	timestamp: bigint;
	id: string;
	typ: CRDTOperationType;
}

export type CRDTOperationType = SharedOperation | RelationOperation | OwnedOperation;

export interface Color {
	red: number;
	green: number;
	blue: number;
}

export interface FilePath {
	id: string;
	path: string;
	file: string | null;
}

export interface OwnedOperation {
	model: string;
	items: Array<OwnedOperationItem>;
}

export type OwnedOperationData =
	| { Create: Record<string, any> }
	| { Update: Record<string, any> }
	| 'Delete';

export interface OwnedOperationItem {
	id: any;
	data: OwnedOperationData;
}

export interface RelationOperation {
	relation_item: string;
	relation_group: string;
	relation: string;
	data: RelationOperationData;
}

export type RelationOperationData = 'Create' | { Update: { field: string; value: any } } | 'Delete';

export interface SharedOperation {
	record_id: string;
	model: string;
	data: SharedOperationData;
}

export type SharedOperationCreateData = { Unique: Record<string, any> } | 'Atomic';

export type SharedOperationData =
	| { Create: SharedOperationCreateData }
	| { Update: { field: string; value: any } }
	| 'Delete';

export interface Tag {
	color: Color;
	name: string;
}
