import { Controller, Post, Body } from '@nestjs/common';
import { EmailService } from './email.service';
// import { MailerService } from '@nestjs-modules/mailer';
class ContactFormDto {
    name: string;
    email: string;
    message: string;
  }

@Controller('email')
export class EmailController {
  constructor(private emailService: EmailService) {}

  @Post()
  async sendContactEmail(@Body() contactData: {
    name: string;
    email: string;
    message: string;
  }) {
    await this.emailService.sendContactEmail(
      contactData.name,
      contactData.email,
      contactData.message
    );
    return { message: 'Contact form submitted successfully' };
  }
  @Post('contact')
  async handleContactForm(@Body() contactData: ContactFormDto) {
    await this.emailService.sendContactEmail(
      contactData.name,
      contactData.email,
      contactData.message
    );
    return { message: 'Thank you for your message. We will contact you soon.' };
  }
}