package session

import (
	"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/session"
)

type SaveUseCase struct {
	sessionRepo session.Repository
}

// ProvideSaveUseCase creates the use case for Wire
func ProvideSaveUseCase(sessionRepo session.Repository) *SaveUseCase {
	return &SaveUseCase{sessionRepo: sessionRepo}
}

// Execute saves an existing session (for updates)
func (uc *SaveUseCase) Execute(sess *session.Session) error {
	if sess == nil {
		return nil
	}
	return uc.sessionRepo.Save(sess)
}
