package materialorder

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"

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

type MaterialOrder 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"`
	Doctor_Code  *string            `json:"doctor_code"`
	Doctor       *ed.Doctor         `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
	Status_Code  erc.DataStatusCode `json:"status_code"`
}

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

func (d MaterialOrder) IsSameDoctor(doctor_code *string) bool {
	return d.Doctor_Code == doctor_code
}
