package subscribeplanrepository

import (
	subscribeplandomain "legalgo-BE-go/internal/domain/subscribe_plan"

	"github.com/google/uuid"
)

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

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

	return subscribePlan, nil
}
