2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-16 08:03:27 -07:00
|
|
|
import { datetimeSchema } from '../utils';
|
|
|
|
|
2024-08-28 04:43:23 -07:00
|
|
|
/** @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/} */
|
2024-10-13 15:25:30 -07:00
|
|
|
const adminCohortSchema = v.object({
|
2024-10-16 08:03:27 -07:00
|
|
|
period: datetimeSchema,
|
2024-10-14 11:54:44 -07:00
|
|
|
frequency: v.picklist(['day', 'month']),
|
2024-10-14 13:50:34 -07:00
|
|
|
data: v.array(v.object({
|
2024-10-16 08:03:27 -07:00
|
|
|
date: datetimeSchema,
|
2024-10-14 11:54:44 -07:00
|
|
|
rate: v.number(),
|
|
|
|
value: v.pipe(v.number(), v.integer()),
|
2024-08-28 04:43:23 -07:00
|
|
|
})),
|
|
|
|
});
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type AdminCohort = v.InferOutput<typeof adminCohortSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export {
|
|
|
|
adminCohortSchema,
|
|
|
|
type AdminCohort,
|
|
|
|
};
|