/** * rSocials Automerge document schemas. * * Granularity: one Automerge document per space. * DocId format: {space}:socials:data * * Images stay on filesystem, referenced by URL strings in the doc. */ import type { DocSchema } from '../../shared/local-first/document'; // ── Thread types ── export interface ThreadData { id: string; name: string; handle: string; title: string; tweets: string[]; imageUrl?: string; tweetImages?: Record; createdAt: number; updatedAt: number; } // ── Campaign types ── export interface CampaignPost { id: string; platform: string; postType: string; stepNumber: number; content: string; scheduledAt: string; status: string; hashtags: string[]; phase: number; phaseLabel: string; } export interface Campaign { id: string; title: string; description: string; duration: string; platforms: string[]; phases: { name: string; label: string; days: string }[]; posts: CampaignPost[]; createdAt: number; updatedAt: number; } // ── Document root ── export interface SocialsDoc { meta: { module: string; collection: string; version: number; spaceSlug: string; createdAt: number; }; threads: Record; campaigns: Record; } // ── Schema registration ── export const socialsSchema: DocSchema = { module: 'socials', collection: 'data', version: 1, init: (): SocialsDoc => ({ meta: { module: 'socials', collection: 'data', version: 1, spaceSlug: '', createdAt: Date.now(), }, threads: {}, campaigns: {}, }), }; // ── Helpers ── export function socialsDocId(space: string) { return `${space}:socials:data` as const; }