package channel // ChannelLINE represents a LINE Official Account channel configuration. // Reference: LINE Messaging API — https://developers.line.biz/en/docs/messaging-api/ // // GoChat addition — LINE Messaging API integration. // The LINE channel connects LINE Official Accounts to gochat conversations. // // Key LINE API concepts: // - Channel Access Token: long-lived token for API calls (renewable) // - Channel Secret: used for webhook signature verification (HMAC-SHA256) // - LINE Login: OAuth2 flow for user authentication (optional) // - Webhook URL: where LINE sends event notifications // // Design notes: // - Uses GORM soft-delete pattern consistent with other channel models // - JSON field tags follow snake_case convention per P2D §7 // - Channel-specific fields (channel_access_token, channel_secret) are stored // in Inbox.ChannelConfig rather than in this model, keeping the model lean // per the Chatwoot pattern where channel_type specific config lives in the polymorphic association import "gorm.io/gorm" // ChannelLINE is the GORM model for LINE Official Account channels. // Reference: Chatwoot does not have LINE channel support — this is a GoChat addition. // Design: Follows the same pattern as ChannelTelegram — minimal GORM model with // config stored in Inbox.ChannelConfig (JSONB). type ChannelLINE struct { gorm.Model // LINE Channel ID (from LINE Developers Console) // Unique identifier for the LINE Official Account ChannelID string `json:"channel_id" gorm:"type:varchar(255);uniqueIndex;not null"` // LINE Official Account name (display name) Name string `json:"name" gorm:"type:varchar(255)"` // AccountID references the owning account (multi-tenant) // Foreign key to accounts table for tenant isolation AccountID uint `json:"account_id" gorm:"index;not null"` // InboxID references the associated inbox (1:1 with channel) InboxID uint `json:"inbox_id" gorm:"uniqueIndex;not null"` } // TableName overrides GORM table name convention. func (ChannelLINE) TableName() string { return "channel_lines" } // Channelable interface implementation for ChannelLINE. // Returns LINE-specific identifiers and display name. func (c *ChannelLINE) GetChannelType() string { return "line" } func (c *ChannelLINE) GetChannelID() string { return c.ChannelID } func (c *ChannelLINE) GetName() string { return c.Name } func (c *ChannelLINE) GetAccountID() uint { return c.AccountID } func (c *ChannelLINE) GetInboxID() uint { return c.InboxID } func (c *ChannelLINE) SetInboxID(id uint) { c.InboxID = id }