package micromcuorder

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

type MicroMcuOrder struct {
	eamob.MicroMcuOrder
	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     []*emmoi.MicroMcuOrderItem `json:"items" gorm:"foreignKey:MicroMcuOrder_Id;references:Id"`
}

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

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

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