File size: 2,356 Bytes
00a4363
 
34b0226
 
00a4363
 
 
 
 
 
 
 
 
 
 
 
34b0226
00a4363
 
 
 
 
 
 
 
 
 
 
 
 
 
34b0226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00a4363
 
 
 
 
 
 
34b0226
 
 
 
 
 
 
 
00a4363
34b0226
 
00a4363
34b0226
 
00a4363
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { z } from "zod";

// Shared props schema. The backend builds these (app/pipeline/media.py); every composition validates
// its props before rendering.

export const brandSchema = z
  .object({
    accent: z.string().regex(/^#[0-9a-fA-F]{6}$/).optional(),
    logoUrl: z.string().url().optional(),
    name: z.string().optional(),
  })
  .default({});

export const captionWordSchema = z.object({ text: z.string(), startMs: z.number(), endMs: z.number() });

export const sceneSchema = z.object({
  type: z.enum(["title", "section", "pull_quote", "number", "outro"]).catch("section"),
  onScreenText: z.string(),
  narration: z.string().default(""),
  durationS: z.number().min(0.5).max(60),
  citation: z.string().optional(),
});

export const shortVerticalSchema = z.object({
  hook: z.string().max(120),
  scenes: z.array(sceneSchema).min(1),
  captions: z.array(captionWordSchema).default([]),
  audioUrl: z.string().url().optional(),
  brand: brandSchema,
});

export const explainerLongSchema = z.object({
  title: z.string().max(140),
  scenes: z.array(sceneSchema).min(1),
  captions: z.array(captionWordSchema).default([]),
  audioUrl: z.string().url().optional(),
  brand: brandSchema,
});

export const segmentSchema = z.object({
  speaker: z.string(),
  text: z.string(),
  startMs: z.number(),
  endMs: z.number(),
});

export const audiogramSquareSchema = z.object({
  title: z.string().max(140),
  audioUrl: z.string().url(),
  durationS: z.number().min(1).max(600),
  segments: z.array(segmentSchema).default([]),
  brand: brandSchema,
});

export const quoteCardSchema = z.object({
  quote: z.string().max(400),
  author: z.string(),
  publication: z.string().optional(),
  brand: brandSchema,
});

export const carouselSlideSchema = z.object({
  heading: z.string().max(120),
  body: z.string().max(500).default(""),
  index: z.number().int().min(1),
  total: z.number().int().min(1),
  brand: brandSchema,
});

export type ShortVerticalProps = z.infer<typeof shortVerticalSchema>;
export type ExplainerLongProps = z.infer<typeof explainerLongSchema>;
export type AudiogramSquareProps = z.infer<typeof audiogramSquareSchema>;
export type QuoteCardProps = z.infer<typeof quoteCardSchema>;
export type CarouselSlideProps = z.infer<typeof carouselSlideSchema>;
export type Scene = z.infer<typeof sceneSchema>;

export const FPS = 30;