package database

import (
	"api_es/internal/models"
	"api_es/pkg/logger"

	"gorm.io/gorm"
)

func SeedInitialData(db *gorm.DB) error {
	zapLogger := logger.Get()
	zapLogger.Debug("start fill init data")
	// Создание базовых удобств
	amenities := []models.Amenity{
		{Name: "Wi-Fi", Category: "basic", Icon: "wifi"},
		{Name: "Парковка", Category: "basic", Icon: "parking"},
		{Name: "Бассейн", Category: "comfort", Icon: "pool"},
		// ... другие удобства
	}

	for _, amenity := range amenities {
		if err := db.FirstOrCreate(&amenity, models.Amenity{Name: amenity.Name}).Error; err != nil {
			return err
		}
	}

	zapLogger.Debug("end fill init data")
	return nil
}
