package subscribeplanrepository

import (
	"legalgo-BE-go/database"

	"github.com/google/uuid"
)

func (s *SubsPlan) GetDefault() (*database.SubscribePlan, error) {
	var subscribePlan *database.SubscribePlan

	if err := s.DB.First(&subscribePlan, "code = ?", "basic").Error; err != nil {
		s.DB.Create(&database.SubscribePlan{
			ID:   uuid.NewString(),
			Code: "basic",
			Name: "Basic",
		})
	}

	return subscribePlan, nil
}
