<template>
    <form class="add-project-form" @submit.prevent="submitForm">
      <h2>Ajouter un projet</h2>
  
      <div class="form-group">
        <label for="name">Nom du projet</label>
        <input
          id="name"
          v-model="form.name"
          type="text"
          required
        />
      </div>
  
      <h3>Entrepreneur</h3>
  
      <div class="form-group">
        <label for="founderName">Nom</label>
        <input
          id="founderName"
          v-model="form.founder.userName"
          type="text"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderSurname">Prénom</label>
        <input
          id="founderSurname"
          v-model="form.founder.userSurname"
          type="text"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderPrimaryMail">Email Principal</label>
        <input
          id="founderPrimaryMail"
          v-model="form.founder.primaryMail"
          type="email"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderSecondaryMail">Email Secondaire</label>
        <input
          id="founderSecondaryMail"
          v-model="form.founder.secondaryMail"
          type="email"
        />
      </div>
      <div class="form-group">
        <label for="founderPhoneNumber">Numéro de téléphone</label>
        <input
          id="founderPhoneNumber"
          v-model="form.founder.phoneNumber"
          type="tel"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderSchool">École</label>
        <input
          id="founderSchool"
          v-model="form.founder.school"
          type="text"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderCourse">Département</label>
        <input
          id="founderCourse"
          v-model="form.founder.course"
          type="text"
          required
        />
      </div>
      <div class="form-group">
        <label for="founderSneeStatus">Statut étudiant entrepreneur</label>
        <input
          id="founderSneeStatus"
          v-model="form.founder.sneeStatus"
          type="checkbox"
        />
      </div>
  
      <button type="submit">Soumettre</button>
    </form>
  </template>
  
  <script setup lang="ts">
  import { ref } from "vue";
  import { postApi } from "@/services/api"; 
  
  const form = ref({
    name: '',
    founder: {
      userSurname: '',
      userName: '',
      primaryMail: '',
      secondaryMail: '',
      phoneNumber: '',
      school: '',
      course: '',
      sneeStatus: false
    }
  });
  
  function submitForm() {
    postApi("/entrepreneur/projects/request", form.value);
  }
  </script>
  
  <style scoped>
  .add-project-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  h2 {
    margin-bottom: 20px;
    font-size: 24px;
    color: #333;
  }
  
  h3 {
    margin-top: 20px;
    font-size: 20px;
    color: #555;
  }
  
  .form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
  }
  
  label {
    font-weight: bold;
    margin-bottom: 5px;
  }
  
  input {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 1em;
  }
  
  input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
  }
  
  button {
    background-color: #4caf50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    width: 100%;
  }
  
  button:hover {
    background-color: #45a049;
  }
  
  button:active {
    background-color: #388e3c;
  }
  
  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="tel"]:focus {
    border-color: #4CAF50;
    outline: none;
  }
  </style>
  