models

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

ABOUTME: Data models for CRM entities ABOUTME: Defines Contact, Company, Deal, and DealNote structs

Index

Constants

View Source
const (
	StageProspecting   = "prospecting"
	StageQualification = "qualification"
	StageProposal      = "proposal"
	StageNegotiation   = "negotiation"
	StageClosedWon     = "closed_won"
	StageClosedLost    = "closed_lost"
)
View Source
const (
	StrengthWeak   = "weak"
	StrengthMedium = "medium"
	StrengthStrong = "strong"
)

RelationshipStrength constants.

View Source
const (
	InteractionMeeting = "meeting"
	InteractionCall    = "call"
	InteractionEmail   = "email"
	InteractionMessage = "message"
	InteractionEvent   = "event"
)

InteractionType constants.

View Source
const (
	SentimentPositive = "positive"
	SentimentNeutral  = "neutral"
	SentimentNegative = "negative"
)

Sentiment constants.

View Source
const (
	SyncStatusIdle    = "idle"
	SyncStatusSyncing = "syncing"
	SyncStatusError   = "error"
)

Sync status constants.

View Source
const (
	SuggestionTypeDeal         = "deal"
	SuggestionTypeRelationship = "relationship"
	SuggestionTypeCompany      = "company"
)

Suggestion type constants.

View Source
const (
	SuggestionStatusPending  = "pending"
	SuggestionStatusAccepted = "accepted"
	SuggestionStatusRejected = "rejected"
)

Suggestion status constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Company

type Company struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	Domain    string    `json:"domain,omitempty"`
	Industry  string    `json:"industry,omitempty"`
	Notes     string    `json:"notes,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Contact

type Contact struct {
	ID              uuid.UUID  `json:"id"`
	Name            string     `json:"name"`
	Email           string     `json:"email,omitempty"`
	Phone           string     `json:"phone,omitempty"`
	CompanyID       *uuid.UUID `json:"company_id,omitempty"`
	Notes           string     `json:"notes,omitempty"`
	LastContactedAt *time.Time `json:"last_contacted_at,omitempty"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
}

type ContactCadence

type ContactCadence struct {
	ContactID            uuid.UUID  `json:"contact_id"`
	CadenceDays          int        `json:"cadence_days"`
	RelationshipStrength string     `json:"relationship_strength"`
	PriorityScore        float64    `json:"priority_score"`
	LastInteractionDate  *time.Time `json:"last_interaction_date,omitempty"`
	NextFollowupDate     *time.Time `json:"next_followup_date,omitempty"`
}

func (*ContactCadence) ComputePriorityScore

func (c *ContactCadence) ComputePriorityScore() float64

ComputePriorityScore calculates the priority score for a contact Based on days overdue and relationship strength.

func (*ContactCadence) UpdateNextFollowup

func (c *ContactCadence) UpdateNextFollowup()

UpdateNextFollowup sets the next followup date based on last interaction and cadence.

type Deal

type Deal struct {
	ID                uuid.UUID  `json:"id"`
	Title             string     `json:"title"`
	Amount            int64      `json:"amount,omitempty"` // in cents
	Currency          string     `json:"currency"`
	Stage             string     `json:"stage"`
	CompanyID         uuid.UUID  `json:"company_id"`
	ContactID         *uuid.UUID `json:"contact_id,omitempty"`
	ExpectedCloseDate *time.Time `json:"expected_close_date,omitempty"`
	CreatedAt         time.Time  `json:"created_at"`
	UpdatedAt         time.Time  `json:"updated_at"`
	LastActivityAt    time.Time  `json:"last_activity_at"`
}

type DealNote

type DealNote struct {
	ID        uuid.UUID `json:"id"`
	DealID    uuid.UUID `json:"deal_id"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"created_at"`
}

type FollowupContact

type FollowupContact struct {
	Contact
	CadenceDays          int        `json:"cadence_days"`
	RelationshipStrength string     `json:"relationship_strength"`
	PriorityScore        float64    `json:"priority_score"`
	DaysSinceContact     int        `json:"days_since_contact"`
	NextFollowupDate     *time.Time `json:"next_followup_date,omitempty"`
}

FollowupContact combines Contact with cadence info for follow-up views.

type InteractionLog

type InteractionLog struct {
	ID              uuid.UUID `json:"id"`
	ContactID       uuid.UUID `json:"contact_id"`
	InteractionType string    `json:"interaction_type"`
	Timestamp       time.Time `json:"timestamp"`
	Notes           string    `json:"notes,omitempty"`
	Sentiment       *string   `json:"sentiment,omitempty"`
	Metadata        string    `json:"metadata,omitempty"`
}

type Relationship

type Relationship struct {
	ID               uuid.UUID `json:"id"`
	ContactID1       uuid.UUID `json:"contact_id_1"`
	ContactID2       uuid.UUID `json:"contact_id_2"`
	RelationshipType string    `json:"relationship_type,omitempty"`
	Context          string    `json:"context,omitempty"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type Suggestion

type Suggestion struct {
	ID            uuid.UUID  `json:"id"`
	Type          string     `json:"type"`
	Confidence    float64    `json:"confidence"`
	SourceService string     `json:"source_service"`
	SourceID      string     `json:"source_id,omitempty"`
	SourceData    string     `json:"source_data,omitempty"`
	Status        string     `json:"status"`
	CreatedAt     time.Time  `json:"created_at"`
	ReviewedAt    *time.Time `json:"reviewed_at,omitempty"`
}

type SyncLog

type SyncLog struct {
	ID            uuid.UUID `json:"id"`
	SourceService string    `json:"source_service"`
	SourceID      string    `json:"source_id"`
	EntityType    string    `json:"entity_type"`
	EntityID      uuid.UUID `json:"entity_id"`
	ImportedAt    time.Time `json:"imported_at"`
	Metadata      string    `json:"metadata,omitempty"`
}

type SyncState

type SyncState struct {
	Service       string     `json:"service"`
	LastSyncTime  *time.Time `json:"last_sync_time,omitempty"`
	LastSyncToken string     `json:"last_sync_token,omitempty"`
	Status        string     `json:"status"`
	ErrorMessage  string     `json:"error_message,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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