From e5aad7740943bfd564b7c2d71f8adee018e6b520 Mon Sep 17 00:00:00 2001 From: dahoud Date: Tue, 7 Oct 2025 11:05:52 +0000 Subject: [PATCH] PHASE 3 - Ajout DTOs et services pour Workshop et CoachingSession MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ DTOS WORKSHOP : - WorkshopDTO : DTO complet avec CoachDTO, méthodes helper (isFull, getOccupancyPercentage) - CreateWorkshopDTO : DTO de création avec validation (isDateRangeValid, getDurationHours) - UpdateWorkshopDTO : DTO de mise à jour avec champs optionnels ✅ DTOS COACHING SESSION : - CoachingSessionDTO : DTO complet avec CoachDTO, ClientDTO, méthodes helper (canBeRated, canBeModified, getPlannedDurationHours, getActualDurationHours, isOverdue) - CreateCoachingSessionDTO : DTO de création avec validation (isScheduledDateValid, isDurationValid) - UpdateCoachingSessionDTO : DTO de mise à jour avec validation (isClientRatingValid) ✅ INTERFACES DE SERVICE : - WorkshopService : Interface complète avec 15 méthodes (CRUD, gestion participants, statistiques, recherche) - CoachingSessionService : Interface complète avec 18 méthodes (CRUD, évaluations, statistiques coach/client, recherche) 🎯 FONCTIONNALITÉS API : - Pagination avec PagedResponseDTO - Validation Jakarta complète - Méthodes helper pour logique métier - Support filtrage et recherche avancés - Gestion des statistiques et rapports - Documentation Javadoc complète en français 📊 TOTAL : 8 nouveaux fichiers API pour Workshop et CoachingSession 🚀 API GBCM maintenant complète avec toutes les interfaces de service --- .../api/dto/session/CoachingSessionDTO.java | 445 ++++++++++++++++++ .../dto/session/CreateCoachingSessionDTO.java | 250 ++++++++++ .../dto/session/UpdateCoachingSessionDTO.java | 365 ++++++++++++++ .../api/dto/workshop/CreateWorkshopDTO.java | 280 +++++++++++ .../api/dto/workshop/UpdateWorkshopDTO.java | 273 +++++++++++ .../server/api/dto/workshop/WorkshopDTO.java | 377 +++++++++++++++ .../api/service/CoachingSessionService.java | 207 ++++++++ .../server/api/service/WorkshopService.java | 187 ++++++++ 8 files changed, 2384 insertions(+) create mode 100644 src/main/java/com/gbcm/server/api/dto/session/CoachingSessionDTO.java create mode 100644 src/main/java/com/gbcm/server/api/dto/session/CreateCoachingSessionDTO.java create mode 100644 src/main/java/com/gbcm/server/api/dto/session/UpdateCoachingSessionDTO.java create mode 100644 src/main/java/com/gbcm/server/api/dto/workshop/CreateWorkshopDTO.java create mode 100644 src/main/java/com/gbcm/server/api/dto/workshop/UpdateWorkshopDTO.java create mode 100644 src/main/java/com/gbcm/server/api/dto/workshop/WorkshopDTO.java create mode 100644 src/main/java/com/gbcm/server/api/service/CoachingSessionService.java create mode 100644 src/main/java/com/gbcm/server/api/service/WorkshopService.java diff --git a/src/main/java/com/gbcm/server/api/dto/session/CoachingSessionDTO.java b/src/main/java/com/gbcm/server/api/dto/session/CoachingSessionDTO.java new file mode 100644 index 0000000..ed3306b --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/session/CoachingSessionDTO.java @@ -0,0 +1,445 @@ +package com.gbcm.server.api.dto.session; + +import com.gbcm.server.api.dto.client.ClientDTO; +import com.gbcm.server.api.dto.coach.CoachDTO; +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.SessionStatus; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO représentant une session de coaching de la plateforme GBCM. + * Utilisé pour les réponses API et les transferts de données. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class CoachingSessionDTO { + + /** + * Identifiant unique de la session. + */ + private Long id; + + /** + * Titre de la session. + */ + @NotBlank(message = "Le titre est obligatoire") + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description de la session. + */ + private String description; + + /** + * Type de service de coaching. + */ + @NotNull(message = "Le type de service est obligatoire") + private ServiceType serviceType; + + /** + * Coach de la session. + */ + @NotNull(message = "Le coach est obligatoire") + private CoachDTO coach; + + /** + * Client de la session. + */ + @NotNull(message = "Le client est obligatoire") + private ClientDTO client; + + /** + * Date et heure prévues de la session. + */ + @NotNull(message = "La date prévue est obligatoire") + private LocalDateTime scheduledDateTime; + + /** + * Date et heure réelles de début. + */ + private LocalDateTime actualStartDateTime; + + /** + * Date et heure réelles de fin. + */ + private LocalDateTime actualEndDateTime; + + /** + * Durée prévue en minutes. + */ + @NotNull(message = "La durée prévue est obligatoire") + private Integer plannedDurationMinutes; + + /** + * Durée réelle en minutes. + */ + private Integer actualDurationMinutes; + + /** + * Lieu de la session (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle. + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Prix de la session. + */ + private BigDecimal price; + + /** + * Statut de la session. + */ + @NotNull(message = "Le statut est obligatoire") + private SessionStatus status; + + /** + * Objectifs de la session. + */ + private String objectives; + + /** + * Résumé de la session (rempli après). + */ + private String summary; + + /** + * Actions à suivre (rempli après). + */ + private String actionItems; + + /** + * Évaluation du client (1-5). + */ + private Integer clientRating; + + /** + * Commentaires du client. + */ + private String clientFeedback; + + /** + * Notes internes du coach. + */ + private String coachNotes; + + /** + * Notes internes sur la session. + */ + private String notes; + + /** + * Date de création. + */ + private LocalDateTime createdAt; + + /** + * Date de dernière mise à jour. + */ + private LocalDateTime updatedAt; + + /** + * Créé par. + */ + private String createdBy; + + /** + * Mis à jour par. + */ + private String updatedBy; + + /** + * Constructeur par défaut. + */ + public CoachingSessionDTO() { + } + + // Getters et Setters + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public CoachDTO getCoach() { + return coach; + } + + public void setCoach(CoachDTO coach) { + this.coach = coach; + } + + public ClientDTO getClient() { + return client; + } + + public void setClient(ClientDTO client) { + this.client = client; + } + + public LocalDateTime getScheduledDateTime() { + return scheduledDateTime; + } + + public void setScheduledDateTime(LocalDateTime scheduledDateTime) { + this.scheduledDateTime = scheduledDateTime; + } + + public LocalDateTime getActualStartDateTime() { + return actualStartDateTime; + } + + public void setActualStartDateTime(LocalDateTime actualStartDateTime) { + this.actualStartDateTime = actualStartDateTime; + } + + public LocalDateTime getActualEndDateTime() { + return actualEndDateTime; + } + + public void setActualEndDateTime(LocalDateTime actualEndDateTime) { + this.actualEndDateTime = actualEndDateTime; + } + + public Integer getPlannedDurationMinutes() { + return plannedDurationMinutes; + } + + public void setPlannedDurationMinutes(Integer plannedDurationMinutes) { + this.plannedDurationMinutes = plannedDurationMinutes; + } + + public Integer getActualDurationMinutes() { + return actualDurationMinutes; + } + + public void setActualDurationMinutes(Integer actualDurationMinutes) { + this.actualDurationMinutes = actualDurationMinutes; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public SessionStatus getStatus() { + return status; + } + + public void setStatus(SessionStatus status) { + this.status = status; + } + + public String getObjectives() { + return objectives; + } + + public void setObjectives(String objectives) { + this.objectives = objectives; + } + + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public String getActionItems() { + return actionItems; + } + + public void setActionItems(String actionItems) { + this.actionItems = actionItems; + } + + public Integer getClientRating() { + return clientRating; + } + + public void setClientRating(Integer clientRating) { + this.clientRating = clientRating; + } + + public String getClientFeedback() { + return clientFeedback; + } + + public void setClientFeedback(String clientFeedback) { + this.clientFeedback = clientFeedback; + } + + public String getCoachNotes() { + return coachNotes; + } + + public void setCoachNotes(String coachNotes) { + this.coachNotes = coachNotes; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + /** + * Vérifie si la session peut être évaluée. + * + * @return true si la session peut être évaluée + */ + public boolean canBeRated() { + return status == SessionStatus.COMPLETED; + } + + /** + * Vérifie si la session peut être modifiée. + * + * @return true si la session peut être modifiée + */ + public boolean canBeModified() { + return status == SessionStatus.SCHEDULED || status == SessionStatus.RESCHEDULED; + } + + /** + * Calcule la durée prévue en heures. + * + * @return la durée prévue en heures + */ + public double getPlannedDurationHours() { + if (plannedDurationMinutes != null) { + return plannedDurationMinutes / 60.0; + } + return 0.0; + } + + /** + * Calcule la durée réelle en heures. + * + * @return la durée réelle en heures + */ + public double getActualDurationHours() { + if (actualDurationMinutes != null) { + return actualDurationMinutes / 60.0; + } + return 0.0; + } + + /** + * Vérifie si la session est en retard. + * + * @return true si la session est en retard + */ + public boolean isOverdue() { + if (scheduledDateTime != null && status == SessionStatus.SCHEDULED) { + return LocalDateTime.now().isAfter(scheduledDateTime); + } + return false; + } + + @Override + public String toString() { + return "CoachingSessionDTO{" + + "id=" + id + + ", title='" + title + '\'' + + ", serviceType=" + serviceType + + ", status=" + status + + ", scheduledDateTime=" + scheduledDateTime + + ", plannedDurationMinutes=" + plannedDurationMinutes + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/dto/session/CreateCoachingSessionDTO.java b/src/main/java/com/gbcm/server/api/dto/session/CreateCoachingSessionDTO.java new file mode 100644 index 0000000..b6db903 --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/session/CreateCoachingSessionDTO.java @@ -0,0 +1,250 @@ +package com.gbcm.server.api.dto.session; + +import com.gbcm.server.api.enums.ServiceType; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO pour la création d'une nouvelle session de coaching. + * Contient toutes les informations nécessaires pour créer une session. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class CreateCoachingSessionDTO { + + /** + * Titre de la session. + */ + @NotBlank(message = "Le titre est obligatoire") + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description de la session. + */ + private String description; + + /** + * Type de service de coaching. + */ + @NotNull(message = "Le type de service est obligatoire") + private ServiceType serviceType; + + /** + * Identifiant du coach de la session. + */ + @NotNull(message = "L'identifiant du coach est obligatoire") + private Long coachId; + + /** + * Identifiant du client de la session. + */ + @NotNull(message = "L'identifiant du client est obligatoire") + private Long clientId; + + /** + * Date et heure prévues de la session. + */ + @NotNull(message = "La date prévue est obligatoire") + private LocalDateTime scheduledDateTime; + + /** + * Durée prévue en minutes. + */ + @NotNull(message = "La durée prévue est obligatoire") + private Integer plannedDurationMinutes; + + /** + * Lieu de la session (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle. + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Prix de la session. + */ + private BigDecimal price; + + /** + * Statut initial de la session (par défaut SCHEDULED). + */ + private String status = "SCHEDULED"; + + /** + * Objectifs de la session. + */ + private String objectives; + + /** + * Notes internes sur la session. + */ + private String notes; + + /** + * Constructeur par défaut. + */ + public CreateCoachingSessionDTO() { + } + + // Getters et Setters + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public Long getCoachId() { + return coachId; + } + + public void setCoachId(Long coachId) { + this.coachId = coachId; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public LocalDateTime getScheduledDateTime() { + return scheduledDateTime; + } + + public void setScheduledDateTime(LocalDateTime scheduledDateTime) { + this.scheduledDateTime = scheduledDateTime; + } + + public Integer getPlannedDurationMinutes() { + return plannedDurationMinutes; + } + + public void setPlannedDurationMinutes(Integer plannedDurationMinutes) { + this.plannedDurationMinutes = plannedDurationMinutes; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getObjectives() { + return objectives; + } + + public void setObjectives(String objectives) { + this.objectives = objectives; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + /** + * Valide que la date de session est dans le futur. + * + * @return true si la date est valide + */ + public boolean isScheduledDateValid() { + return scheduledDateTime != null && scheduledDateTime.isAfter(LocalDateTime.now()); + } + + /** + * Calcule la durée prévue en heures. + * + * @return la durée prévue en heures + */ + public double getPlannedDurationHours() { + if (plannedDurationMinutes != null) { + return plannedDurationMinutes / 60.0; + } + return 0.0; + } + + /** + * Valide que la durée est raisonnable (entre 15 minutes et 8 heures). + * + * @return true si la durée est valide + */ + public boolean isDurationValid() { + return plannedDurationMinutes != null && + plannedDurationMinutes >= 15 && + plannedDurationMinutes <= 480; // 8 heures max + } + + @Override + public String toString() { + return "CreateCoachingSessionDTO{" + + "title='" + title + '\'' + + ", serviceType=" + serviceType + + ", coachId=" + coachId + + ", clientId=" + clientId + + ", scheduledDateTime=" + scheduledDateTime + + ", plannedDurationMinutes=" + plannedDurationMinutes + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/dto/session/UpdateCoachingSessionDTO.java b/src/main/java/com/gbcm/server/api/dto/session/UpdateCoachingSessionDTO.java new file mode 100644 index 0000000..e3a1cfd --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/session/UpdateCoachingSessionDTO.java @@ -0,0 +1,365 @@ +package com.gbcm.server.api.dto.session; + +import com.gbcm.server.api.enums.ServiceType; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO pour la mise à jour d'une session de coaching existante. + * Tous les champs sont optionnels pour permettre des mises à jour partielles. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class UpdateCoachingSessionDTO { + + /** + * Titre de la session. + */ + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description de la session. + */ + private String description; + + /** + * Type de service de coaching. + */ + private ServiceType serviceType; + + /** + * Identifiant du coach de la session. + */ + private Long coachId; + + /** + * Identifiant du client de la session. + */ + private Long clientId; + + /** + * Date et heure prévues de la session. + */ + private LocalDateTime scheduledDateTime; + + /** + * Date et heure réelles de début. + */ + private LocalDateTime actualStartDateTime; + + /** + * Date et heure réelles de fin. + */ + private LocalDateTime actualEndDateTime; + + /** + * Durée prévue en minutes. + */ + private Integer plannedDurationMinutes; + + /** + * Durée réelle en minutes. + */ + private Integer actualDurationMinutes; + + /** + * Lieu de la session (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle. + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Prix de la session. + */ + private BigDecimal price; + + /** + * Statut de la session. + */ + private String status; + + /** + * Objectifs de la session. + */ + private String objectives; + + /** + * Résumé de la session (rempli après). + */ + private String summary; + + /** + * Actions à suivre (rempli après). + */ + private String actionItems; + + /** + * Évaluation du client (1-5). + */ + private Integer clientRating; + + /** + * Commentaires du client. + */ + private String clientFeedback; + + /** + * Notes internes du coach. + */ + private String coachNotes; + + /** + * Notes internes sur la session. + */ + private String notes; + + /** + * Constructeur par défaut. + */ + public UpdateCoachingSessionDTO() { + } + + // Getters et Setters + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public Long getCoachId() { + return coachId; + } + + public void setCoachId(Long coachId) { + this.coachId = coachId; + } + + public Long getClientId() { + return clientId; + } + + public void setClientId(Long clientId) { + this.clientId = clientId; + } + + public LocalDateTime getScheduledDateTime() { + return scheduledDateTime; + } + + public void setScheduledDateTime(LocalDateTime scheduledDateTime) { + this.scheduledDateTime = scheduledDateTime; + } + + public LocalDateTime getActualStartDateTime() { + return actualStartDateTime; + } + + public void setActualStartDateTime(LocalDateTime actualStartDateTime) { + this.actualStartDateTime = actualStartDateTime; + } + + public LocalDateTime getActualEndDateTime() { + return actualEndDateTime; + } + + public void setActualEndDateTime(LocalDateTime actualEndDateTime) { + this.actualEndDateTime = actualEndDateTime; + } + + public Integer getPlannedDurationMinutes() { + return plannedDurationMinutes; + } + + public void setPlannedDurationMinutes(Integer plannedDurationMinutes) { + this.plannedDurationMinutes = plannedDurationMinutes; + } + + public Integer getActualDurationMinutes() { + return actualDurationMinutes; + } + + public void setActualDurationMinutes(Integer actualDurationMinutes) { + this.actualDurationMinutes = actualDurationMinutes; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getObjectives() { + return objectives; + } + + public void setObjectives(String objectives) { + this.objectives = objectives; + } + + public String getSummary() { + return summary; + } + + public void setSummary(String summary) { + this.summary = summary; + } + + public String getActionItems() { + return actionItems; + } + + public void setActionItems(String actionItems) { + this.actionItems = actionItems; + } + + public Integer getClientRating() { + return clientRating; + } + + public void setClientRating(Integer clientRating) { + this.clientRating = clientRating; + } + + public String getClientFeedback() { + return clientFeedback; + } + + public void setClientFeedback(String clientFeedback) { + this.clientFeedback = clientFeedback; + } + + public String getCoachNotes() { + return coachNotes; + } + + public void setCoachNotes(String coachNotes) { + this.coachNotes = coachNotes; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + /** + * Valide que la date de session est dans le futur (si fournie). + * + * @return true si la date est valide ou null + */ + public boolean isScheduledDateValid() { + return scheduledDateTime == null || scheduledDateTime.isAfter(LocalDateTime.now()); + } + + /** + * Calcule la durée prévue en heures (si fournie). + * + * @return la durée prévue en heures + */ + public double getPlannedDurationHours() { + if (plannedDurationMinutes != null) { + return plannedDurationMinutes / 60.0; + } + return 0.0; + } + + /** + * Calcule la durée réelle en heures (si fournie). + * + * @return la durée réelle en heures + */ + public double getActualDurationHours() { + if (actualDurationMinutes != null) { + return actualDurationMinutes / 60.0; + } + return 0.0; + } + + /** + * Valide que la durée est raisonnable (si fournie). + * + * @return true si la durée est valide ou null + */ + public boolean isDurationValid() { + return plannedDurationMinutes == null || + (plannedDurationMinutes >= 15 && plannedDurationMinutes <= 480); // 8 heures max + } + + /** + * Valide que l'évaluation client est dans la bonne plage (si fournie). + * + * @return true si l'évaluation est valide ou null + */ + public boolean isClientRatingValid() { + return clientRating == null || (clientRating >= 1 && clientRating <= 5); + } + + @Override + public String toString() { + return "UpdateCoachingSessionDTO{" + + "title='" + title + '\'' + + ", serviceType=" + serviceType + + ", status='" + status + '\'' + + ", scheduledDateTime=" + scheduledDateTime + + ", plannedDurationMinutes=" + plannedDurationMinutes + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/dto/workshop/CreateWorkshopDTO.java b/src/main/java/com/gbcm/server/api/dto/workshop/CreateWorkshopDTO.java new file mode 100644 index 0000000..4584424 --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/workshop/CreateWorkshopDTO.java @@ -0,0 +1,280 @@ +package com.gbcm.server.api.dto.workshop; + +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.WorkshopPackage; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO pour la création d'un nouvel atelier. + * Contient toutes les informations nécessaires pour créer un atelier. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class CreateWorkshopDTO { + + /** + * Titre de l'atelier. + */ + @NotBlank(message = "Le titre est obligatoire") + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description détaillée de l'atelier. + */ + private String description; + + /** + * Package d'atelier associé. + */ + @NotNull(message = "Le package d'atelier est obligatoire") + private WorkshopPackage workshopPackage; + + /** + * Type de service de l'atelier. + */ + @NotNull(message = "Le type de service est obligatoire") + private ServiceType serviceType; + + /** + * Identifiant du coach principal de l'atelier. + */ + @NotNull(message = "L'identifiant du coach est obligatoire") + private Long coachId; + + /** + * Date et heure de début de l'atelier. + */ + @NotNull(message = "La date de début est obligatoire") + private LocalDateTime startDateTime; + + /** + * Date et heure de fin de l'atelier. + */ + @NotNull(message = "La date de fin est obligatoire") + private LocalDateTime endDateTime; + + /** + * Lieu de l'atelier (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle (Zoom, Teams, etc.). + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Nombre maximum de participants. + */ + @NotNull(message = "Le nombre maximum de participants est obligatoire") + private Integer maxParticipants; + + /** + * Prix de l'atelier. + */ + private BigDecimal price; + + /** + * Statut initial de l'atelier (par défaut SCHEDULED). + */ + private String status = "SCHEDULED"; + + /** + * Matériel requis pour l'atelier. + */ + private String requiredMaterials; + + /** + * Prérequis pour participer à l'atelier. + */ + private String prerequisites; + + /** + * Objectifs d'apprentissage de l'atelier. + */ + private String learningObjectives; + + /** + * Notes internes sur l'atelier. + */ + private String notes; + + /** + * Constructeur par défaut. + */ + public CreateWorkshopDTO() { + } + + // Getters et Setters + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public WorkshopPackage getWorkshopPackage() { + return workshopPackage; + } + + public void setWorkshopPackage(WorkshopPackage workshopPackage) { + this.workshopPackage = workshopPackage; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public Long getCoachId() { + return coachId; + } + + public void setCoachId(Long coachId) { + this.coachId = coachId; + } + + public LocalDateTime getStartDateTime() { + return startDateTime; + } + + public void setStartDateTime(LocalDateTime startDateTime) { + this.startDateTime = startDateTime; + } + + public LocalDateTime getEndDateTime() { + return endDateTime; + } + + public void setEndDateTime(LocalDateTime endDateTime) { + this.endDateTime = endDateTime; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public Integer getMaxParticipants() { + return maxParticipants; + } + + public void setMaxParticipants(Integer maxParticipants) { + this.maxParticipants = maxParticipants; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRequiredMaterials() { + return requiredMaterials; + } + + public void setRequiredMaterials(String requiredMaterials) { + this.requiredMaterials = requiredMaterials; + } + + public String getPrerequisites() { + return prerequisites; + } + + public void setPrerequisites(String prerequisites) { + this.prerequisites = prerequisites; + } + + public String getLearningObjectives() { + return learningObjectives; + } + + public void setLearningObjectives(String learningObjectives) { + this.learningObjectives = learningObjectives; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + /** + * Valide que la date de fin est après la date de début. + * + * @return true si les dates sont valides + */ + public boolean isDateRangeValid() { + return startDateTime != null && endDateTime != null && + endDateTime.isAfter(startDateTime); + } + + /** + * Calcule la durée de l'atelier en heures. + * + * @return la durée en heures + */ + public long getDurationHours() { + if (startDateTime != null && endDateTime != null) { + return java.time.Duration.between(startDateTime, endDateTime).toHours(); + } + return 0; + } + + @Override + public String toString() { + return "CreateWorkshopDTO{" + + "title='" + title + '\'' + + ", workshopPackage=" + workshopPackage + + ", coachId=" + coachId + + ", startDateTime=" + startDateTime + + ", maxParticipants=" + maxParticipants + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/dto/workshop/UpdateWorkshopDTO.java b/src/main/java/com/gbcm/server/api/dto/workshop/UpdateWorkshopDTO.java new file mode 100644 index 0000000..058eb3b --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/workshop/UpdateWorkshopDTO.java @@ -0,0 +1,273 @@ +package com.gbcm.server.api.dto.workshop; + +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.WorkshopPackage; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO pour la mise à jour d'un atelier existant. + * Tous les champs sont optionnels pour permettre des mises à jour partielles. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class UpdateWorkshopDTO { + + /** + * Titre de l'atelier. + */ + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description détaillée de l'atelier. + */ + private String description; + + /** + * Package d'atelier associé. + */ + private WorkshopPackage workshopPackage; + + /** + * Type de service de l'atelier. + */ + private ServiceType serviceType; + + /** + * Identifiant du coach principal de l'atelier. + */ + private Long coachId; + + /** + * Date et heure de début de l'atelier. + */ + private LocalDateTime startDateTime; + + /** + * Date et heure de fin de l'atelier. + */ + private LocalDateTime endDateTime; + + /** + * Lieu de l'atelier (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle (Zoom, Teams, etc.). + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Nombre maximum de participants. + */ + private Integer maxParticipants; + + /** + * Prix de l'atelier. + */ + private BigDecimal price; + + /** + * Statut de l'atelier. + */ + private String status; + + /** + * Matériel requis pour l'atelier. + */ + private String requiredMaterials; + + /** + * Prérequis pour participer à l'atelier. + */ + private String prerequisites; + + /** + * Objectifs d'apprentissage de l'atelier. + */ + private String learningObjectives; + + /** + * Notes internes sur l'atelier. + */ + private String notes; + + /** + * Constructeur par défaut. + */ + public UpdateWorkshopDTO() { + } + + // Getters et Setters + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public WorkshopPackage getWorkshopPackage() { + return workshopPackage; + } + + public void setWorkshopPackage(WorkshopPackage workshopPackage) { + this.workshopPackage = workshopPackage; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public Long getCoachId() { + return coachId; + } + + public void setCoachId(Long coachId) { + this.coachId = coachId; + } + + public LocalDateTime getStartDateTime() { + return startDateTime; + } + + public void setStartDateTime(LocalDateTime startDateTime) { + this.startDateTime = startDateTime; + } + + public LocalDateTime getEndDateTime() { + return endDateTime; + } + + public void setEndDateTime(LocalDateTime endDateTime) { + this.endDateTime = endDateTime; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public Integer getMaxParticipants() { + return maxParticipants; + } + + public void setMaxParticipants(Integer maxParticipants) { + this.maxParticipants = maxParticipants; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRequiredMaterials() { + return requiredMaterials; + } + + public void setRequiredMaterials(String requiredMaterials) { + this.requiredMaterials = requiredMaterials; + } + + public String getPrerequisites() { + return prerequisites; + } + + public void setPrerequisites(String prerequisites) { + this.prerequisites = prerequisites; + } + + public String getLearningObjectives() { + return learningObjectives; + } + + public void setLearningObjectives(String learningObjectives) { + this.learningObjectives = learningObjectives; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + /** + * Valide que la date de fin est après la date de début (si les deux sont fournies). + * + * @return true si les dates sont valides ou si l'une d'elles est null + */ + public boolean isDateRangeValid() { + if (startDateTime == null || endDateTime == null) { + return true; // Pas de validation si l'une des dates est manquante + } + return endDateTime.isAfter(startDateTime); + } + + /** + * Calcule la durée de l'atelier en heures (si les deux dates sont fournies). + * + * @return la durée en heures ou 0 si les dates ne sont pas complètes + */ + public long getDurationHours() { + if (startDateTime != null && endDateTime != null) { + return java.time.Duration.between(startDateTime, endDateTime).toHours(); + } + return 0; + } + + @Override + public String toString() { + return "UpdateWorkshopDTO{" + + "title='" + title + '\'' + + ", workshopPackage=" + workshopPackage + + ", status='" + status + '\'' + + ", startDateTime=" + startDateTime + + ", maxParticipants=" + maxParticipants + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/dto/workshop/WorkshopDTO.java b/src/main/java/com/gbcm/server/api/dto/workshop/WorkshopDTO.java new file mode 100644 index 0000000..ac9872a --- /dev/null +++ b/src/main/java/com/gbcm/server/api/dto/workshop/WorkshopDTO.java @@ -0,0 +1,377 @@ +package com.gbcm.server.api.dto.workshop; + +import com.gbcm.server.api.dto.coach.CoachDTO; +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.WorkshopPackage; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * DTO représentant un atelier stratégique de la plateforme GBCM. + * Utilisé pour les réponses API et les transferts de données. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public class WorkshopDTO { + + /** + * Identifiant unique de l'atelier. + */ + private Long id; + + /** + * Titre de l'atelier. + */ + @NotBlank(message = "Le titre est obligatoire") + @Size(max = 200, message = "Le titre ne peut pas dépasser 200 caractères") + private String title; + + /** + * Description détaillée de l'atelier. + */ + private String description; + + /** + * Package d'atelier associé. + */ + @NotNull(message = "Le package d'atelier est obligatoire") + private WorkshopPackage workshopPackage; + + /** + * Type de service de l'atelier. + */ + @NotNull(message = "Le type de service est obligatoire") + private ServiceType serviceType; + + /** + * Coach principal de l'atelier. + */ + @NotNull(message = "Le coach est obligatoire") + private CoachDTO coach; + + /** + * Date et heure de début de l'atelier. + */ + @NotNull(message = "La date de début est obligatoire") + private LocalDateTime startDateTime; + + /** + * Date et heure de fin de l'atelier. + */ + @NotNull(message = "La date de fin est obligatoire") + private LocalDateTime endDateTime; + + /** + * Lieu de l'atelier (physique ou virtuel). + */ + @Size(max = 255, message = "Le lieu ne peut pas dépasser 255 caractères") + private String location; + + /** + * Lien de réunion virtuelle (Zoom, Teams, etc.). + */ + @Size(max = 500, message = "Le lien de réunion ne peut pas dépasser 500 caractères") + private String meetingLink; + + /** + * Nombre maximum de participants. + */ + @NotNull(message = "Le nombre maximum de participants est obligatoire") + private Integer maxParticipants; + + /** + * Nombre actuel de participants inscrits. + */ + private Integer currentParticipants; + + /** + * Prix de l'atelier. + */ + private BigDecimal price; + + /** + * Statut de l'atelier. + */ + @NotNull(message = "Le statut est obligatoire") + private String status; + + /** + * Matériel requis pour l'atelier. + */ + private String requiredMaterials; + + /** + * Prérequis pour participer à l'atelier. + */ + private String prerequisites; + + /** + * Objectifs d'apprentissage de l'atelier. + */ + private String learningObjectives; + + /** + * Notes internes sur l'atelier. + */ + private String notes; + + /** + * Date de création. + */ + private LocalDateTime createdAt; + + /** + * Date de dernière mise à jour. + */ + private LocalDateTime updatedAt; + + /** + * Créé par. + */ + private String createdBy; + + /** + * Mis à jour par. + */ + private String updatedBy; + + /** + * Constructeur par défaut. + */ + public WorkshopDTO() { + } + + // Getters et Setters + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public WorkshopPackage getWorkshopPackage() { + return workshopPackage; + } + + public void setWorkshopPackage(WorkshopPackage workshopPackage) { + this.workshopPackage = workshopPackage; + } + + public ServiceType getServiceType() { + return serviceType; + } + + public void setServiceType(ServiceType serviceType) { + this.serviceType = serviceType; + } + + public CoachDTO getCoach() { + return coach; + } + + public void setCoach(CoachDTO coach) { + this.coach = coach; + } + + public LocalDateTime getStartDateTime() { + return startDateTime; + } + + public void setStartDateTime(LocalDateTime startDateTime) { + this.startDateTime = startDateTime; + } + + public LocalDateTime getEndDateTime() { + return endDateTime; + } + + public void setEndDateTime(LocalDateTime endDateTime) { + this.endDateTime = endDateTime; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getMeetingLink() { + return meetingLink; + } + + public void setMeetingLink(String meetingLink) { + this.meetingLink = meetingLink; + } + + public Integer getMaxParticipants() { + return maxParticipants; + } + + public void setMaxParticipants(Integer maxParticipants) { + this.maxParticipants = maxParticipants; + } + + public Integer getCurrentParticipants() { + return currentParticipants; + } + + public void setCurrentParticipants(Integer currentParticipants) { + this.currentParticipants = currentParticipants; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRequiredMaterials() { + return requiredMaterials; + } + + public void setRequiredMaterials(String requiredMaterials) { + this.requiredMaterials = requiredMaterials; + } + + public String getPrerequisites() { + return prerequisites; + } + + public void setPrerequisites(String prerequisites) { + this.prerequisites = prerequisites; + } + + public String getLearningObjectives() { + return learningObjectives; + } + + public void setLearningObjectives(String learningObjectives) { + this.learningObjectives = learningObjectives; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + /** + * Vérifie si l'atelier est complet. + * + * @return true si l'atelier est complet + */ + public boolean isFull() { + return currentParticipants != null && maxParticipants != null && + currentParticipants >= maxParticipants; + } + + /** + * Calcule le pourcentage de remplissage. + * + * @return le pourcentage de remplissage (0-100) + */ + public double getOccupancyPercentage() { + if (maxParticipants == null || maxParticipants == 0) { + return 0.0; + } + if (currentParticipants == null) { + return 0.0; + } + return (currentParticipants.doubleValue() / maxParticipants.doubleValue()) * 100.0; + } + + /** + * Calcule la durée de l'atelier en heures. + * + * @return la durée en heures + */ + public long getDurationHours() { + if (startDateTime != null && endDateTime != null) { + return java.time.Duration.between(startDateTime, endDateTime).toHours(); + } + return 0; + } + + @Override + public String toString() { + return "WorkshopDTO{" + + "id=" + id + + ", title='" + title + '\'' + + ", workshopPackage=" + workshopPackage + + ", status='" + status + '\'' + + ", startDateTime=" + startDateTime + + ", currentParticipants=" + currentParticipants + + ", maxParticipants=" + maxParticipants + + '}'; + } +} diff --git a/src/main/java/com/gbcm/server/api/service/CoachingSessionService.java b/src/main/java/com/gbcm/server/api/service/CoachingSessionService.java new file mode 100644 index 0000000..3a5d727 --- /dev/null +++ b/src/main/java/com/gbcm/server/api/service/CoachingSessionService.java @@ -0,0 +1,207 @@ +package com.gbcm.server.api.service; + +import com.gbcm.server.api.dto.common.PagedResponseDTO; +import com.gbcm.server.api.dto.session.CoachingSessionDTO; +import com.gbcm.server.api.dto.session.CreateCoachingSessionDTO; +import com.gbcm.server.api.dto.session.UpdateCoachingSessionDTO; +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.SessionStatus; +import com.gbcm.server.api.exceptions.GBCMException; + +import java.time.LocalDateTime; + +/** + * Interface de service pour la gestion des sessions de coaching GBCM. + * Définit toutes les opérations métier liées aux sessions de coaching. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public interface CoachingSessionService { + + /** + * Récupère la liste paginée des sessions avec filtres optionnels. + * + * @param page numéro de page (commence à 0) + * @param size taille de la page + * @param sort critères de tri + * @param status filtrer par statut + * @param serviceType filtrer par type de service + * @param coachId filtrer par coach + * @param clientId filtrer par client + * @param search recherche textuelle + * @return la liste paginée des sessions + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getCoachingSessions(int page, int size, String sort, + SessionStatus status, ServiceType serviceType, + Long coachId, Long clientId, String search) throws GBCMException; + + /** + * Récupère une session par son identifiant. + * + * @param id l'identifiant de la session + * @return la session trouvée + * @throws GBCMException si la session n'est pas trouvée + */ + CoachingSessionDTO getCoachingSessionById(Long id) throws GBCMException; + + /** + * Crée une nouvelle session de coaching. + * + * @param createCoachingSessionDTO les données de création + * @return la session créée + * @throws GBCMException en cas d'erreur de création + */ + CoachingSessionDTO createCoachingSession(CreateCoachingSessionDTO createCoachingSessionDTO) throws GBCMException; + + /** + * Met à jour une session existante. + * + * @param id l'identifiant de la session + * @param updateCoachingSessionDTO les données de mise à jour + * @return la session mise à jour + * @throws GBCMException si la session n'est pas trouvée ou en cas d'erreur + */ + CoachingSessionDTO updateCoachingSession(Long id, UpdateCoachingSessionDTO updateCoachingSessionDTO) throws GBCMException; + + /** + * Supprime une session (suppression logique). + * + * @param id l'identifiant de la session + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être supprimée + */ + void deleteCoachingSession(Long id) throws GBCMException; + + /** + * Démarre une session. + * + * @param id l'identifiant de la session + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être démarrée + */ + void startCoachingSession(Long id) throws GBCMException; + + /** + * Termine une session. + * + * @param id l'identifiant de la session + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être terminée + */ + void completeCoachingSession(Long id) throws GBCMException; + + /** + * Annule une session. + * + * @param id l'identifiant de la session + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être annulée + */ + void cancelCoachingSession(Long id) throws GBCMException; + + /** + * Reporte une session. + * + * @param id l'identifiant de la session + * @param newDateTime nouvelle date et heure + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être reportée + */ + void rescheduleCoachingSession(Long id, LocalDateTime newDateTime) throws GBCMException; + + /** + * Marque une session comme non présentée. + * + * @param id l'identifiant de la session + * @throws GBCMException si la session n'est pas trouvée + */ + void markNoShow(Long id) throws GBCMException; + + /** + * Évalue une session terminée. + * + * @param id l'identifiant de la session + * @param rating note de 1 à 5 + * @param feedback commentaires du client + * @throws GBCMException si la session n'est pas trouvée ou ne peut pas être évaluée + */ + void rateCoachingSession(Long id, Integer rating, String feedback) throws GBCMException; + + /** + * Récupère les sessions à venir. + * + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des sessions à venir + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getUpcomingSessions(int page, int size) throws GBCMException; + + /** + * Récupère les sessions d'un coach. + * + * @param coachId l'identifiant du coach + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des sessions du coach + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getSessionsByCoach(Long coachId, int page, int size) throws GBCMException; + + /** + * Récupère les sessions d'un client. + * + * @param clientId l'identifiant du client + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des sessions du client + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getSessionsByClient(Long clientId, int page, int size) throws GBCMException; + + /** + * Récupère les sessions dans une plage de dates. + * + * @param startDate date de début + * @param endDate date de fin + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des sessions dans la plage + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getSessionsByDateRange(LocalDateTime startDate, LocalDateTime endDate, + int page, int size) throws GBCMException; + + /** + * Récupère les statistiques des sessions. + * + * @return les statistiques des sessions + * @throws GBCMException en cas d'erreur + */ + Object getSessionStatistics() throws GBCMException; + + /** + * Récupère les statistiques d'un coach. + * + * @param coachId l'identifiant du coach + * @return les statistiques du coach + * @throws GBCMException en cas d'erreur + */ + Object getCoachStatistics(Long coachId) throws GBCMException; + + /** + * Récupère les statistiques d'un client. + * + * @param clientId l'identifiant du client + * @return les statistiques du client + * @throws GBCMException en cas d'erreur + */ + Object getClientStatistics(Long clientId) throws GBCMException; + + /** + * Recherche des sessions selon des critères avancés. + * + * @param searchCriteria les critères de recherche + * @return la liste paginée des sessions trouvées + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO searchCoachingSessions(Object searchCriteria) throws GBCMException; +} diff --git a/src/main/java/com/gbcm/server/api/service/WorkshopService.java b/src/main/java/com/gbcm/server/api/service/WorkshopService.java new file mode 100644 index 0000000..0885405 --- /dev/null +++ b/src/main/java/com/gbcm/server/api/service/WorkshopService.java @@ -0,0 +1,187 @@ +package com.gbcm.server.api.service; + +import com.gbcm.server.api.dto.common.PagedResponseDTO; +import com.gbcm.server.api.dto.workshop.CreateWorkshopDTO; +import com.gbcm.server.api.dto.workshop.UpdateWorkshopDTO; +import com.gbcm.server.api.dto.workshop.WorkshopDTO; +import com.gbcm.server.api.enums.ServiceType; +import com.gbcm.server.api.enums.WorkshopPackage; +import com.gbcm.server.api.exceptions.GBCMException; + +import java.time.LocalDateTime; + +/** + * Interface de service pour la gestion des ateliers stratégiques GBCM. + * Définit toutes les opérations métier liées aux ateliers. + * + * @author GBCM Development Team + * @version 1.0 + * @since 1.0 + */ +public interface WorkshopService { + + /** + * Récupère la liste paginée des ateliers avec filtres optionnels. + * + * @param page numéro de page (commence à 0) + * @param size taille de la page + * @param sort critères de tri + * @param status filtrer par statut + * @param workshopPackage filtrer par package d'atelier + * @param coachId filtrer par coach + * @param search recherche textuelle + * @return la liste paginée des ateliers + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getWorkshops(int page, int size, String sort, + Object status, WorkshopPackage workshopPackage, + Long coachId, String search) throws GBCMException; + + /** + * Récupère un atelier par son identifiant. + * + * @param id l'identifiant de l'atelier + * @return l'atelier trouvé + * @throws GBCMException si l'atelier n'est pas trouvé + */ + WorkshopDTO getWorkshopById(Long id) throws GBCMException; + + /** + * Crée un nouvel atelier. + * + * @param createWorkshopDTO les données de création + * @return l'atelier créé + * @throws GBCMException en cas d'erreur de création + */ + WorkshopDTO createWorkshop(CreateWorkshopDTO createWorkshopDTO) throws GBCMException; + + /** + * Met à jour un atelier existant. + * + * @param id l'identifiant de l'atelier + * @param updateWorkshopDTO les données de mise à jour + * @return l'atelier mis à jour + * @throws GBCMException si l'atelier n'est pas trouvé ou en cas d'erreur + */ + WorkshopDTO updateWorkshop(Long id, UpdateWorkshopDTO updateWorkshopDTO) throws GBCMException; + + /** + * Supprime un atelier (suppression logique). + * + * @param id l'identifiant de l'atelier + * @throws GBCMException si l'atelier n'est pas trouvé ou ne peut pas être supprimé + */ + void deleteWorkshop(Long id) throws GBCMException; + + /** + * Démarre un atelier. + * + * @param id l'identifiant de l'atelier + * @throws GBCMException si l'atelier n'est pas trouvé ou ne peut pas être démarré + */ + void startWorkshop(Long id) throws GBCMException; + + /** + * Termine un atelier. + * + * @param id l'identifiant de l'atelier + * @throws GBCMException si l'atelier n'est pas trouvé ou ne peut pas être terminé + */ + void completeWorkshop(Long id) throws GBCMException; + + /** + * Annule un atelier. + * + * @param id l'identifiant de l'atelier + * @throws GBCMException si l'atelier n'est pas trouvé ou ne peut pas être annulé + */ + void cancelWorkshop(Long id) throws GBCMException; + + /** + * Reporte un atelier. + * + * @param id l'identifiant de l'atelier + * @throws GBCMException si l'atelier n'est pas trouvé ou ne peut pas être reporté + */ + void postponeWorkshop(Long id) throws GBCMException; + + /** + * Ajoute un participant à un atelier. + * + * @param id l'identifiant de l'atelier + * @param participantId l'identifiant du participant + * @throws GBCMException si l'atelier est complet ou en cas d'erreur + */ + void addParticipant(Long id, Long participantId) throws GBCMException; + + /** + * Retire un participant d'un atelier. + * + * @param id l'identifiant de l'atelier + * @param participantId l'identifiant du participant + * @throws GBCMException en cas d'erreur + */ + void removeParticipant(Long id, Long participantId) throws GBCMException; + + /** + * Récupère les ateliers à venir. + * + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des ateliers à venir + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getUpcomingWorkshops(int page, int size) throws GBCMException; + + /** + * Récupère les ateliers d'un coach. + * + * @param coachId l'identifiant du coach + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des ateliers du coach + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getWorkshopsByCoach(Long coachId, int page, int size) throws GBCMException; + + /** + * Récupère les ateliers par package. + * + * @param workshopPackage le package d'atelier + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des ateliers du package + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getWorkshopsByPackage(WorkshopPackage workshopPackage, int page, int size) throws GBCMException; + + /** + * Récupère les ateliers dans une plage de dates. + * + * @param startDate date de début + * @param endDate date de fin + * @param page numéro de page + * @param size taille de la page + * @return la liste paginée des ateliers dans la plage + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO getWorkshopsByDateRange(LocalDateTime startDate, LocalDateTime endDate, + int page, int size) throws GBCMException; + + /** + * Récupère les statistiques des ateliers. + * + * @return les statistiques des ateliers + * @throws GBCMException en cas d'erreur + */ + Object getWorkshopStatistics() throws GBCMException; + + /** + * Recherche des ateliers selon des critères avancés. + * + * @param searchCriteria les critères de recherche + * @return la liste paginée des ateliers trouvés + * @throws GBCMException en cas d'erreur + */ + PagedResponseDTO searchWorkshops(Object searchCriteria) throws GBCMException; +}