/**
 * Auth DTOs with Zod Validation
 * Mecánicas Diesel - ERP Suite
 */

import { z } from 'zod';

// Login Schema
export const loginSchema = z.object({
  email: z.string().email('Email inválido'),
  password: z.string().min(8, 'La contraseña debe tener al menos 8 caracteres'),
});

export type LoginDto = z.infer<typeof loginSchema>;

// Register Schema
export const registerSchema = z.object({
  email: z.string().email('Email inválido'),
  password: z.string().min(8, 'La contraseña debe tener al menos 8 caracteres'),
  full_name: z.string().min(2, 'El nombre completo es requerido'),
  taller_name: z.string().optional(),
});

export type RegisterDto = z.infer<typeof registerSchema>;

// Change Password Schema
export const changePasswordSchema = z.object({
  currentPassword: z.string().min(1, 'Contraseña actual requerida'),
  newPassword: z.string().min(8, 'La nueva contraseña debe tener al menos 8 caracteres'),
});

export type ChangePasswordDto = z.infer<typeof changePasswordSchema>;

// Refresh Token Schema
export const refreshTokenSchema = z.object({
  refreshToken: z.string().min(1, 'Refresh token requerido'),
});

export type RefreshTokenDto = z.infer<typeof refreshTokenSchema>;
