import { z } from 'zod';
import { DevelopmentModeEnum } from './types';

/**
 * 搜索表单校验
 */
export const searchFormSchema = z.object({
  teamCode: z.string().optional(),
  teamName: z.string().optional(),
  enabled: z.boolean().optional(),
});

/**
 * 团队表单校验
 */
export const teamFormSchema = z.object({
  teamCode: z.string().min(1, '团队编码不能为空'),
  teamName: z.string().min(1, '团队名称不能为空'),
  description: z.string().max(500, "团队描述不能超过500个字符").optional(),
  ownerId: z.number().optional(),
  ownerName: z.string().optional(),
  enabled: z.boolean().default(true),
  sort: z.number().min(0).default(0),
  developmentMode: z.nativeEnum(DevelopmentModeEnum).default(DevelopmentModeEnum.STANDARD),
  enableGitSyncCheck: z.boolean().default(false),
});

export type SearchFormValues = z.infer<typeof searchFormSchema>;
export type TeamFormValues = z.infer<typeof teamFormSchema>;

