import { z } from 'zod';

export const loginSchema = z.object({
  emailOrUsername: z.string().min(1, { message: 'Email or username is required' }),
  password: z.string().min(1, { message: 'Password is required' }),
});
export type LoginFormData = z.infer<typeof loginSchema>;

export const registerSchema = z.object({
  email: z.string().email({ message: 'Invalid email address' }),
  password: z.string().min(8, { message: 'Password needs to be at least 8 characters long' }),
  username: z.string().min(1, { message: 'Username is required' }),
});
export type RegisterFormData = z.infer<typeof registerSchema>;

export const resetPasswordSchema = z
  .object({
    password: z.string().min(8, 'Password must be at least 8 characters'),
    confirmPassword: z.string(),
  })
  .refine((data) => data.password === data.confirmPassword, {
    message: "Passwords don't match",
    path: ['confirmPassword'],
  });

export type ResetPasswordFormData = z.infer<typeof resetPasswordSchema>;

export interface AuthLayoutProps {
  title: string;
  children: React.ReactNode;
  footerText?: string;
  linkText?: string;
  linkHref?: string;
}
