package persistence

import (
	"github.com/nexuscrm/shared/pkg/constants"
	"github.com/nexuscrm/shared/pkg/models"
)

func leadGeneratedSearchSchema() *models.ObjectMetadata {
	active := "active"
	formulaExpr := "Email"
	return &models.ObjectMetadata{
		APIName:    "Lead",
		Searchable: true,
		Fields: []models.FieldMetadata{
			{APIName: constants.FieldID, Type: constants.FieldTypeString, IsSystem: true},
			{APIName: constants.FieldName, Type: constants.FieldTypeString, IsNameField: true},
			{APIName: "Email", Type: constants.FieldTypeEmail},
			{APIName: "SearchText", Type: constants.FieldTypeFormula, Formula: &formulaExpr, FormulaMode: &active},
			{APIName: constants.FieldIsDeleted, Type: constants.FieldTypeBoolean, IsSystem: true},
		},
	}
}
