core

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package core provides core business logic for article type resolution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapCommunicationChannel

func MapCommunicationChannel(articleTypeID int) int

MapCommunicationChannel derives communication_channel_id from article_type_id. Channel IDs (OTRS-aligned intent): 1 = email, 2 = phone, 3 = internal (notes / system), future: 4 = chat, 5 = sms, etc. Fallback returns 3 (internal) for safety so internal-only content is not misclassified.

func ValidateArticleCombination

func ValidateArticleCombination(articleTypeID, senderTypeID int, visible bool) error

ValidateArticleCombination ensures semantic correctness for persistence time. e.g., customer cannot create internal note; system cannot create phone call initiated by itself (enforced conservatively here).

Types

type ArticleIntent

type ArticleIntent struct {
	// Interaction is a coarse UI semantic (email, phone, internal_note, external_note)
	Interaction constants.InteractionType
	// ExplicitArticleTypeID if >0 overrides Interaction mapping
	ExplicitArticleTypeID int
	// SenderTypeID required (agent=1, system=2, customer=3)
	SenderTypeID int
	// ForceVisible optional override for customer visibility (nil => derive default)
	ForceVisible *bool
}

ArticleIntent captures high-level request/user intent for creating an article.

type LookupOption

type LookupOption struct {
	ID          int    `json:"id"`
	Value       string `json:"value"`        // Internal database value
	DisplayText string `json:"display_text"` // Translated display text
	IsSystem    bool   `json:"is_system"`    // Whether this is a system-defined value
	SortOrder   int    `json:"sort_order"`
	IsActive    bool   `json:"is_active"`
}

LookupOption represents a single option in a dropdown/select field.

type LookupService

type LookupService struct {
	// contains filtered or unexported fields
}

LookupService provides translated lookup values for dropdowns.

func NewLookupService

func NewLookupService(repo *data.LookupsRepository) *LookupService

NewLookupService creates a new lookup service.

func (*LookupService) AddCustomTranslation

func (s *LookupService) AddCustomTranslation(ctx context.Context, tableName, fieldValue, lang, translation string) error

AddCustomTranslation allows admins to add translations for custom values.

func (*LookupService) ClearCache

func (s *LookupService) ClearCache()

ClearCache clears the lookup cache.

func (*LookupService) GetQueues

func (s *LookupService) GetQueues(ctx context.Context, lang string) ([]LookupOption, error)

GetQueues returns all available queues with optional translations.

func (*LookupService) GetTicketPriorities

func (s *LookupService) GetTicketPriorities(ctx context.Context, lang string) ([]LookupOption, error)

GetTicketPriorities returns all available ticket priorities with translations.

func (*LookupService) GetTicketStates

func (s *LookupService) GetTicketStates(ctx context.Context, lang string) ([]LookupOption, error)

GetTicketStates returns all available ticket states with translations.

func (*LookupService) GetTicketTypes

func (s *LookupService) GetTicketTypes(ctx context.Context, lang string) ([]LookupOption, error)

GetTicketTypes returns all available ticket types with translations.

type ResolvedArticle

type ResolvedArticle struct {
	ArticleTypeID       int
	ArticleSenderTypeID int
	CustomerVisible     bool
}

ResolvedArticle holds derived fields ready for persistence.

func DetermineArticleType

func DetermineArticleType(intent ArticleIntent) (ResolvedArticle, error)

3. Fallback (internal note for agent/system, email-external for customer).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL