package medication

import (
	"time"

	ecore "simrs-vx/internal/domain/base-entities/core"
	ee "simrs-vx/internal/domain/main-entities/encounter"
	ep "simrs-vx/internal/domain/main-entities/pharmacist"

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

type Medication struct {
	ecore.Main                         // adjust this according to the needs
	Encounter_Id    *uint              `json:"encounter_id"`
	Encounter       *ee.Encounter      `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
	IssuedAt        *time.Time         `json:"issuedAt"`
	Pharmacist_Code *string            `json:"pharmacist_code"`
	Pharmacist      *ep.Pharmacist     `json:"pharmacist,omitempty" gorm:"foreignKey:Pharmacist_Code;references:Code"`
	Status_Code     erc.DataStatusCode `json:"status_code"`
}

func (d Medication) IsCompleted() bool {
	return d.Status_Code == erc.DSCDone
}
