import { z } from "zod"; import { WORKSPACE_ROLES, WORKSPACE_TYPES } from "../../constants.js"; export const CreateWorkspaceDto = z.object({ name: z.string().min(1).max(50), slug: z .string() .min(2) .max(50) .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/) .optional() }); export type CreateWorkspaceInput = z.infer; export const UpdateWorkspaceDto = z.object({ name: z.string().min(1).max(50).optional(), slug: z.string().min(2).max(50).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional(), description: z.string().max(500).nullable().optional(), iconUrl: z.string().url().max(2048).nullable().optional(), // T-136: space type (directory grouping/filter). No permission semantics. type: z.enum(WORKSPACE_TYPES).optional() }); export type UpdateWorkspaceInput = z.infer; // T-136: space directory (extends the existing `GET /workspaces` listMine // route with optional filters/sort — the web sidebar already calls it with no // query params, which stays the default). export const ListWorkspacesQuery = z.object({ search: z.string().max(100).optional(), type: z.enum(WORKSPACE_TYPES).optional(), archived: z.enum(["true", "false"]).optional(), sort: z.enum(["name", "recent", "created"]).optional() }); export type ListWorkspacesInput = z.infer; export const InviteMemberDto = z.object({ email: z.string().email().max(254), role: z.enum(WORKSPACE_ROLES).default("MEMBER") }); export type InviteMemberInput = z.infer; export const UpdateMemberRoleDto = z.object({ role: z.enum(WORKSPACE_ROLES) }); export type UpdateMemberRoleInput = z.infer; export const TransferWorkspaceDto = z.object({ newOwnerId: z.string().min(1) }); export type TransferWorkspaceInput = z.infer; export const ListMembersQuery = z.object({ search: z.string().max(100).optional(), cursor: z.string().optional(), limit: z.string().optional() }); export type ListMembersInput = z.infer;