import {z} from "zod";

export const ListPageSchema = z.object({
    path: z.string(),
    name: z.string(),
    sha: z.string(),
    downloadUrl: z.string().url(),
    id: z.number().positive()
});

export type ListPage = z.infer<typeof ListPageSchema>;

export const PageListSchema = z.array(ListPageSchema)

export type PageList = z.infer<typeof PageListSchema>;

export const PageSchema = z.object({
    path: z.string(),
    name: z.string(),
    sha: z.string(),
    downloadUrl: z.string().url(),
    content: z.string(),
    size: z.number().gte(0),
    id: z.number().positive()
})

export type Page = z.infer<typeof PageSchema>;

export type Pages = {
    dirs: {[key: string]: Pages},
    files: {[key: string]: ListPage}
}