package services

import (
	"streamService/internal/app/models"
	"streamService/internal/app/repositories"
)

type StreamService interface {
	GetAllStreams() ([]models.Stream, error)
	GetStreamByID(id uint) (*models.Stream, error)
	CreateStream(stream *models.Stream) error
	UpdateStream(stream *models.Stream) error
	DeleteStream(id uint) error
}

type streamService struct {
	repo repositories.StreamRepository
}

func NewStreamService(repo repositories.StreamRepository) StreamService {
	return &streamService{repo}
}

func (s *streamService) GetAllStreams() ([]models.Stream, error) {
	return s.repo.GetAllStreams()
}

func (s *streamService) GetStreamByID(id uint) (*models.Stream, error) {
	return s.repo.GetStreamByID(id)
}

func (s *streamService) CreateStream(stream *models.Stream) error {
	return s.repo.CreateStream(stream)
}

func (s *streamService) UpdateStream(stream *models.Stream) error {
	return s.repo.UpdateStream(stream)
}

func (s *streamService) DeleteStream(id uint) error {
	return s.repo.DeleteStream(id)
}
