package runbook

import (
	"ops-assistant/models"

	"gorm.io/gorm"
)

func SeedDefaultTargets(db *gorm.DB) error {
	defaults := []models.OpsTarget{
		{Name: "hwsg", Host: "10.2.3.11", Port: 22, User: "root", Enabled: true},
		{Name: "wjynl", Host: "66.235.105.208", Port: 22, User: "root", Enabled: true},
	}
	for _, t := range defaults {
		if err := db.Where("name = ?", t.Name).FirstOrCreate(&t).Error; err != nil {
			return err
		}
	}
	return nil
}
