// utils/emailTemplates/wadizUploaded.ts

import type { WadizBoard } from '~/types/boardItem';

export function generateWadizUploadedEmail(board: Partial<WadizBoard>) {
  const subject = `${board.name || '신청자'}님의 예약 신청이 접수되었습니다`;
  const html = `
    <h2>예약 정보</h2>
    <table>
      ${
        board.name
          ? `<tr><td><strong>이름</strong></td><td>${board.name}</td></tr>`
          : ''
      }
      ${
        board.paymentId
          ? `<tr><td><strong>결제 ID</strong></td><td>${board.paymentId}</td></tr>`
          : ''
      }
      ${
        board.email
          ? `<tr><td><strong>이메일</strong></td><td>${board.email}</td></tr>`
          : ''
      }
      ${
        board.phone
          ? `<tr><td><strong>전화번호</strong></td><td>${board.phone}</td></tr>`
          : ''
      }
      ${
        board.address
          ? `<tr><td><strong>주소</strong></td><td>${board.address}</td></tr>`
          : ''
      }
      ${
        board.emergencyPhone
          ? `<tr><td><strong>비상연락처</strong></td><td>${board.emergencyPhone}</td></tr>`
          : ''
      }
      ${
        board.scheduleStart
          ? `<tr><td><strong>시작일</strong></td><td>${board.scheduleStart}</td></tr>`
          : ''
      }
      ${
        board.scheduleEnd
          ? `<tr><td><strong>종료일</strong></td><td>${board.scheduleEnd}</td></tr>`
          : ''
      }
      ${
        board.attending
          ? `<tr><td><strong>참석 여부</strong></td><td>${
              board.attending === 'yes' ? '참석' : '불참'
            }</td></tr>`
          : ''
      }
      ${
        board.altName
          ? `<tr><td><strong>대리인 이름</strong></td><td>${board.altName}</td></tr>`
          : ''
      }
      ${
        board.altPhone
          ? `<tr><td><strong>대리인 전화번호</strong></td><td>${board.altPhone}</td></tr>`
          : ''
      }
      ${
        board.companions
          ? `<tr><td><strong>동반 인원</strong></td><td>${board.companions}</td></tr>`
          : ''
      }
      ${
        board.healthNotes
          ? `<tr><td><strong>건강/알레르기</strong></td><td>${board.healthNotes}</td></tr>`
          : ''
      }
      ${
        board.remarks
          ? `<tr><td><strong>기타 요청사항</strong></td><td>${board.remarks}</td></tr>`
          : ''
      }
    </table>
    <hr />
    <p>이 메일은 예약 신청 확인용으로 자동 전송되었습니다.</p>
  `;

  return { subject, html };
}
