package mcuordersubitem

import (
	ecore "simrs-vx/internal/domain/base-entities/core"
	emoi "simrs-vx/internal/domain/main-entities/mcu-order-item"
	emss "simrs-vx/internal/domain/main-entities/mcu-sub-src"

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

type McuOrderSubItem struct {
	ecore.Main                         // adjust this according to the needs
	McuSubSrc_Code  *string            `json:"mcuSubSrc_code" gorm:"uniqueIndex:idx_order_sub_src"`
	McuSubSrc       *emss.McuSubSrc    `json:"mcuSubSrc,omitempty" gorm:"foreignKey:McuSubSrc_Code;references:Code"`
	McuOrderItem_Id *uint              `json:"mcuOrderItem_id" gorm:"uniqueIndex:idx_order_sub_src"`
	McuOrderItem    *emoi.McuOrderItem `json:"mcuOrderItem,omitempty" gorm:"foreignKey:McuOrderItem_Id;references:Id"`
	Result          *string            `json:"result"`
	Status_Code     erc.DataStatusCode `json:"status_code"`
}

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