import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { EmailTemporaryAppointmentService } from './email_temporary_appointment.service';

@Controller('email-temporary-appointment')
export class EmailTemporaryAppointmentController {
  constructor(private readonly emailTemporaryAppointmentService: EmailTemporaryAppointmentService) { }

  @Post()
  async sendemail(@Body('email') email: string,
    @Body('name') name: string,
    @Body('HosName') HosName: string,
    @Body('date_time') date_time: string,
    @Body('TEM_APP_NO') TEM_APP_NO: string,
    @Body('company') company: string) {

    try {
      const result = await this.emailTemporaryAppointmentService.temporary_appointment(email, name, HosName, date_time, TEM_APP_NO, company);
      return { success: true, result };
    } catch (error) {
      return { success: false, error: error.message }
    }
  }
}