package resources

import (
	"cloud.o-forge.io/core/oc-lib/models/common/pricing"
	"cloud.o-forge.io/core/oc-lib/models/utils"
	"cloud.o-forge.io/core/oc-lib/tools"
)

type WorkflowResourcePricingProfile struct{}

// WorkflowResource is a struct that represents a workflow resource
// it defines the resource workflow
type WorkflowResource struct {
	AbstractResource
	WorkflowID string `bson:"workflow_id,omitempty" json:"workflow_id,omitempty"` // WorkflowID is the ID of the native workflow
}

func (d *WorkflowResource) GetAccessor(request *tools.APIRequest) utils.Accessor {
	return NewAccessor[*ComputeResource](tools.WORKFLOW_RESOURCE, request, func() utils.DBObject { return &WorkflowResource{} })
}

func (r *WorkflowResource) GetType() string {
	return tools.WORKFLOW_RESOURCE.String()
}

func (d *WorkflowResource) ClearEnv() utils.DBObject {
	return d
}

func (d *WorkflowResource) Trim() {
	/* EMPTY */
}
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
	/* EMPTY */
}

func (w *WorkflowResource) ConvertToPricedResource(
	t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
	return &PricedResource{
		Name:         w.Name,
		Logo:         w.Logo,
		ResourceID:   w.UUID,
		ResourceType: t,
		CreatorID:    w.CreatorID,
	}
}