package services

import (
	"go-account-register/models"
	"go-account-register/utils"
	"time"

	"gorm.io/gorm"
)

type BrowserInstanceService struct {
	db *gorm.DB
}

func InitBrowserInstanceService() *BrowserInstanceService {
	db := utils.GetDB()

	return &BrowserInstanceService{db: db}
}

func (b *BrowserInstanceService) Create(params *models.BrowserInstance) {
	b.db.Create(params)
}

func (b *BrowserInstanceService) Update(browserId string, params *models.BrowserInstance) {
	params.UpdateTime = time.Now().Unix()
	b.db.Model(&models.BrowserInstance{}).Updates(params)
}
