package therapy_protocol

import (
	ecore "simrs-vx/internal/domain/base-entities/core"
	ed "simrs-vx/internal/domain/main-entities/doctor"
	ee "simrs-vx/internal/domain/main-entities/encounter"

	common "simrs-vx/internal/domain/references/common"
)

type TherapyProtocol struct {
	ecore.Main
	Encounter_Id *uint         `json:"encounter_id" gorm:"not null"`
	Encounter    *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`

	Doctor_Code *string    `json:"doctor_code"`
	Doctor      *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`

	Anamnesis         *string                  `json:"anamnesis" gorm:"size:2048"`
	MedicalDiagnoses  *string                  `json:"medicalDiagnoses"`
	FunctionDiagnoses *string                  `json:"functionDiagnoses"`
	Procedures        *string                  `json:"procedures"`
	SupportingExams   *string                  `json:"supportingExams" gorm:"size:2048"`
	Instruction       *string                  `json:"instruction" gorm:"size:2048"`
	Evaluation        *string                  `json:"evaluation" gorm:"size:2048"`
	WorkCauseStatus   *string                  `json:"workCauseStatus" gorm:"size:2048"`
	Frequency         *uint                    `json:"frequency"`
	IntervalUnit_Code *common.TimeUnitCode     `json:"intervalUnit_code" gorm:"size:10"`
	Duration          *uint                    `json:"duration"`
	DurationUnit_Code *common.TimeUnitCode     `json:"durationUnit_code" gorm:"size:10"`
	Status_Code       *common.DataVerifiedCode `json:"status_code" gorm:"size:10"`
}

func (d TherapyProtocol) IsNew() bool {
	return d.Status_Code != nil && *d.Status_Code == common.DVCNew
}
