package channel

import (
	"time"

	"github.com/gochat/gochat/internal/model"
)

// ChannelLine represents a LINE channel configuration.
// Reference: Chatwoot Channel::Line + P2B M2 spec
type ChannelLine struct {
	ID             uint      `gorm:"primaryKey" json:"id"`
	InboxID        uint      `gorm:"uniqueIndex;not null" json:"inbox_id"`
	LineChannelID  string    `gorm:"size:255;not null;index" json:"line_channel_id"`
	AccessToken    string    `gorm:"size:1024;not null" json:"-"`
	ChannelSecret  string    `gorm:"size:255;not null" json:"-"`
	CreatedAt      time.Time `gorm:"autoCreateTime" json:"created_at"`
	UpdatedAt      time.Time `gorm:"autoUpdateTime" json:"updated_at"`

	Inbox model.Inbox `gorm:"foreignKey:InboxID" json:"inbox,omitempty"`
}

func (ChannelLine) TableName() string { return "channel_lines" }
func (c ChannelLine) GetInboxID() uint                    { return c.InboxID }
func (c ChannelLine) GetChannelType() model.InboxChannelType { return model.InboxChannelTypeLine }