package seeds

import (
	"web-qudo-be/app/database/entity"

	"github.com/google/uuid"
)

// CreateNoApprovalWorkflow creates a special workflow that bypasses approval
func CreateNoApprovalWorkflow() *entity.ApprovalWorkflows {
	return &entity.ApprovalWorkflows{
		Name:             "No Approval Required",
		Description:      &[]string{"Workflow for clients that don't require approval process"}[0],
		IsDefault:        &[]bool{false}[0],
		IsActive:         &[]bool{true}[0],
		RequiresApproval: &[]bool{false}[0], // This is the key field
		AutoPublish:      &[]bool{true}[0],  // Auto publish articles
		Steps:            []entity.ApprovalWorkflowSteps{}, // No steps needed
	}
}

// CreateClientApprovalSettings creates default settings for a client
func CreateClientApprovalSettings(clientId string, requiresApproval bool) *entity.ClientApprovalSettings {
	clientUUID, _ := uuid.Parse(clientId)
	return &entity.ClientApprovalSettings{
		ClientId:            clientUUID,
		RequiresApproval:    &[]bool{requiresApproval}[0],
		AutoPublishArticles: &[]bool{!requiresApproval}[0], // Auto publish if no approval needed
		IsActive:            &[]bool{true}[0],
		ApprovalExemptUsers: []uint{},
		ApprovalExemptRoles: []uint{},
		ApprovalExemptCategories: []uint{},
		RequireApprovalFor:  []string{},
		SkipApprovalFor:     []string{},
	}
}
