package radiologymcuorder

import (
	ed "simrs-vx/internal/domain/main-entities/doctor"
	ee "simrs-vx/internal/domain/main-entities/encounter"
	ermoi "simrs-vx/internal/domain/main-entities/radiology-mcu-order-item/base"
	eamob "simrs-vx/internal/domain/main-entities/radiology-mcu-order/base"
	erc "simrs-vx/internal/domain/references/common"
)

type RadiologyMcuOrder struct {
	eamob.RadiologyMcuOrder
	Encounter *ee.Encounter                  `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
	Doctor    *ed.Doctor                     `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
	Items     []*ermoi.RadiologyMcuOrderItem `json:"items" gorm:"foreignKey:RadiologyMcuOrder_Id;references:Id"`
}

func (d RadiologyMcuOrder) IsNotNew() bool {
	return d.Status_Code != erc.DSCNew
}

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

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