2025-11-21 08:31:02 +01:00
|
|
|
import { z } from "zod";
|
2025-04-08 16:01:10 +02:00
|
|
|
import { TextContentFormatSchema } from "../contentformat.ts";
|
2026-02-25 02:34:27 +01:00
|
|
|
import {
|
|
|
|
|
EntitySchema,
|
|
|
|
|
ReferenceSchema,
|
|
|
|
|
TransientEntitySchema,
|
|
|
|
|
} from "../entity.ts";
|
2025-04-08 16:01:10 +02:00
|
|
|
|
|
|
|
|
export const GroupSchema = EntitySchema.extend({
|
|
|
|
|
type: z.literal("pub.versia:groups/Group"),
|
|
|
|
|
name: TextContentFormatSchema.nullish(),
|
|
|
|
|
description: TextContentFormatSchema.nullish(),
|
2026-02-25 02:34:27 +01:00
|
|
|
open: z.boolean(),
|
2025-04-08 16:01:10 +02:00
|
|
|
});
|
|
|
|
|
|
2026-02-25 02:34:27 +01:00
|
|
|
export const GroupSubscribeSchema = TransientEntitySchema.extend({
|
2025-04-08 16:01:10 +02:00
|
|
|
type: z.literal("pub.versia:groups/Subscribe"),
|
2026-02-25 02:34:27 +01:00
|
|
|
subscriber: ReferenceSchema,
|
|
|
|
|
group: ReferenceSchema,
|
2025-04-08 16:01:10 +02:00
|
|
|
});
|
|
|
|
|
|
2026-02-25 02:34:27 +01:00
|
|
|
export const GroupUnsubscribeSchema = TransientEntitySchema.extend({
|
2025-04-08 16:01:10 +02:00
|
|
|
type: z.literal("pub.versia:groups/Unsubscribe"),
|
2026-02-25 02:34:27 +01:00
|
|
|
subscriber: ReferenceSchema,
|
|
|
|
|
group: ReferenceSchema,
|
2025-04-08 16:01:10 +02:00
|
|
|
});
|
|
|
|
|
|
2026-02-25 02:34:27 +01:00
|
|
|
export const GroupSubscribeAcceptSchema = TransientEntitySchema.extend({
|
2025-04-08 16:01:10 +02:00
|
|
|
type: z.literal("pub.versia:groups/SubscribeAccept"),
|
2026-02-25 02:34:27 +01:00
|
|
|
subscriber: ReferenceSchema,
|
|
|
|
|
group: ReferenceSchema,
|
2025-04-08 16:01:10 +02:00
|
|
|
});
|
|
|
|
|
|
2026-02-25 02:34:27 +01:00
|
|
|
export const GroupSubscribeRejectSchema = TransientEntitySchema.extend({
|
2025-04-08 16:01:10 +02:00
|
|
|
type: z.literal("pub.versia:groups/SubscribeReject"),
|
2026-02-25 02:34:27 +01:00
|
|
|
subscriber: ReferenceSchema,
|
|
|
|
|
group: ReferenceSchema,
|
2025-04-08 16:01:10 +02:00
|
|
|
});
|