core

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 3 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 ArticleTypeByName added in v0.10.0

func ArticleTypeByName(name string) (int, bool)

ArticleTypeByName resolves an API article type name. "note" and "email" are accepted as aliases for "note-internal" and "email-external".

func ArticleTypeFromStorage added in v0.10.0

func ArticleTypeFromStorage(channelID int, visibleForCustomer bool) int

ArticleTypeFromStorage derives the article type of a stored article from its communication channel and customer visibility. Types that differ only in detail the schema does not keep (notifications, fax, SMS, web request, report notes) collapse onto the base type of their channel.

func ArticleTypeName added in v0.10.0

func ArticleTypeName(articleTypeID int) string

ArticleTypeName returns the API name of an article type ("" if unknown).

func MapCommunicationChannel

func MapCommunicationChannel(articleTypeID int) int

MapCommunicationChannel derives communication_channel_id from an article type. Fax, SMS and web requests have no dedicated channel in the seeded data and are treated as email. Unknown types map to the internal channel so content is never misclassified as customer-facing transport.

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 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