import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { EmailAppointmentCancelledService } from './email_appointment_cancelled.service';

@Controller('email-appointment-cancelled')
export class EmailAppointmentCancelledController {
  constructor(private readonly emailAppointmentCancelledService: EmailAppointmentCancelledService) { }

  @Post()
  async sendemail(@Body('email') email: string,
    @Body('name') name: string,
    @Body('date') date: Date,
    @Body('reason') reason: string) {


    try {
      const result = await this.emailAppointmentCancelledService.appointment_cancelled(email, name, date, reason);
      return { success: true, result };
    } catch (error) {
      return { success: false, error: error.message }
    }
  }


}
