package models

import "time"

// ConnectionProfile 连接配置模型（SQLite 持久化）
type ConnectionProfile struct {
	ID            uint       `gorm:"primaryKey" json:"id"`
	Name          string     `gorm:"type:varchar(100);not null" json:"name"`
	Host          string     `gorm:"type:varchar(255)" json:"host"`
	Port          int        `gorm:"default:22" json:"port"`
	Username      string     `gorm:"type:varchar(100);default:root" json:"username"`
	Password      string     `gorm:"type:text" json:"password"`
	KeyPath       string     `gorm:"type:text" json:"key_path"`
	Type          string     `gorm:"type:varchar(20);not null;index" json:"type"` // local|remote|sftp
	Token         string     `gorm:"type:text" json:"token"`
	LastConnected *time.Time `json:"last_connected"`
	SortOrder     int        `gorm:"default:0" json:"sort_order"`
	CreatedAt     time.Time  `json:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at"`
}

func (ConnectionProfile) TableName() string { return "connection_profiles" }
