import { z } from 'zod';

export const switchBranchSchema = z.object({
  branchId: z.string().uuid('branchId must be a valid UUID'),
});

export type SwitchBranchInput = z.infer<typeof switchBranchSchema>;

export const createBranchSchema = z.object({
  name: z.string().min(1, 'Branch name is required'),
  address: z.string().optional(),
  phone: z.string().optional(),
  hours: z.record(z.string(), z.any()).optional(),
  timezone: z.string().optional(),
  is_active: z.boolean().optional(),
});

export const updateBranchSchema = z.object({
  name: z.string().min(1).optional(),
  address: z.string().optional(),
  phone: z.string().optional(),
  hours: z.record(z.string(), z.any()).optional(),
  timezone: z.string().optional(),
  is_active: z.boolean().optional(),
  smtp_host: z.string().nullable().optional(),
  smtp_port: z.number().int().nullable().optional(),
  smtp_user: z.string().nullable().optional(),
  smtp_pass: z.string().nullable().optional(),
  smtp_from: z.string().nullable().optional(),
});

export type CreateBranchInput = z.infer<typeof createBranchSchema>;
export type UpdateBranchInput = z.infer<typeof updateBranchSchema>;
