package model

import (
	"time"
)

// ContactNote represents a note attached to a contact.
// Reference: P2B M4 spec
type ContactNote struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	ContactID uint      `gorm:"not null;index" json:"contact_id"`
	UserID    uint      `gorm:"not null" json:"user_id"`
	Content   string    `gorm:"type:text" json:"content"`
	CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`

	Contact Contact `gorm:"foreignKey:ContactID" json:"contact,omitempty"`
	User    User    `gorm:"foreignKey:UserID" json:"user,omitempty"`
}

func (ContactNote) TableName() string { return "contact_notes" }