@startuml !theme mono title 템플릿 선택 내부 시퀀스 participant "API Gateway<>" as Gateway participant "MeetingController" as Controller participant "MeetingService" as Service participant "Meeting" as Domain participant "TemplateService" as TemplateService participant "MeetingRepository" as Repository database "PostgreSQL<>" as DB database "Redis Cache<>" as Cache Gateway -> Controller: PUT /api/meetings/{id}/template activate Controller Controller -> Service: applyTemplate(meetingId, templateId) activate Service Service -> Cache: get(meeting:{id}) activate Cache Cache --> Service: null (cache miss) deactivate Cache Service -> Repository: findById(meetingId) activate Repository Repository -> DB: SELECT * FROM meetings WHERE id = ? activate DB DB --> Repository: meeting_row deactivate DB Repository --> Service: Meeting entity deactivate Repository Service -> TemplateService: getTemplate(templateId) activate TemplateService note right of TemplateService 템플릿 서비스에서 템플릿 구조 조회 end note TemplateService --> Service: Template deactivate TemplateService Service -> Domain: applyTemplate(template) activate Domain Domain -> Domain: validateTemplate() note right of Domain 도메인 규칙: - 템플릿 호환성 검증 - 기존 내용과 병합 규칙 end note Domain --> Service: updated Meeting deactivate Domain Service -> Repository: save(meeting) activate Repository Repository -> DB: UPDATE meetings SET template_id = ? activate DB DB --> Repository: affected_rows deactivate DB Repository --> Service: savedMeeting deactivate Repository Service -> Cache: set(meeting:{id}, meetingData) activate Cache Cache --> Service: OK deactivate Cache Service --> Controller: MeetingResponse deactivate Service Controller --> Gateway: 200 OK deactivate Controller @enduml