import type { z } from "zod"; import { CollectionSchema, URICollectionSchema, } from "../schemas/collection.ts"; import type { JSONObject } from "../types.ts"; import { Entity } from "./entity.ts"; export class Collection extends Entity { public constructor(public override data: z.infer) { super(data); } public static override fromJSON(json: JSONObject): Promise { return CollectionSchema.parseAsync(json).then((u) => new Collection(u)); } } export class URICollection extends Entity { public constructor( public override data: z.infer, ) { super(data); } public static override fromJSON(json: JSONObject): Promise { return URICollectionSchema.parseAsync(json).then( (u) => new URICollection(u), ); } }