package careplan

import (
	"service/internal/interfaces/satusehat"
	"time"
)

func MapRequestToFHIR(req CarePlanRequest) satusehat.FHIRPayload {
	return satusehat.NewFHIRPayload("CarePlan").
		Set("status", req.Status).
		Set("intent", req.Intent).
		Set("title", req.Title).
		Set("description", req.Description).
		Set("subject", map[string]interface{}{
			"reference": "Patient/" + req.PatientID,
			"display":   req.PatientName,
		}).
		Set("encounter", map[string]interface{}{"reference": "Encounter/" + req.EncounterID}).
		Set("author", map[string]interface{}{
			"reference": "Practitioner/" + req.PractitionerID,
			"display":   req.PractitionerName,
		}).
		Set("created", req.CreatedDate.Format(time.RFC3339))
}
