package course_management

import (
	"Yimaru-Backend/internal/domain"
	"context"
)

func (s *Service) CreateSubCourse(
	ctx context.Context,
	courseID int64,
	title string,
	description *string,
	thumbnail *string,
	displayOrder *int32,
	level string,
) (domain.SubCourse, error) {
	return s.courseStore.CreateSubCourse(ctx, courseID, title, description, thumbnail, displayOrder, level)
}

func (s *Service) GetSubCourseByID(
	ctx context.Context,
	id int64,
) (domain.SubCourse, error) {
	return s.courseStore.GetSubCourseByID(ctx, id)
}

func (s *Service) GetSubCoursesByCourse(
	ctx context.Context,
	courseID int64,
) ([]domain.SubCourse, int64, error) {
	return s.courseStore.GetSubCoursesByCourse(ctx, courseID)
}

func (s *Service) ListSubCoursesByCourse(
	ctx context.Context,
	courseID int64,
) ([]domain.SubCourse, error) {
	return s.courseStore.ListSubCoursesByCourse(ctx, courseID)
}

func (s *Service) ListActiveSubCourses(
	ctx context.Context,
) ([]domain.SubCourse, error) {
	return s.courseStore.ListActiveSubCourses(ctx)
}

func (s *Service) UpdateSubCourse(
	ctx context.Context,
	id int64,
	title *string,
	description *string,
	thumbnail *string,
	displayOrder *int32,
	level *string,
	isActive *bool,
) error {
	return s.courseStore.UpdateSubCourse(ctx, id, title, description, thumbnail, displayOrder, level, isActive)
}

func (s *Service) DeactivateSubCourse(
	ctx context.Context,
	id int64,
) error {
	return s.courseStore.DeactivateSubCourse(ctx, id)
}

func (s *Service) DeleteSubCourse(
	ctx context.Context,
	id int64,
) (domain.SubCourse, error) {
	return s.courseStore.DeleteSubCourse(ctx, id)
}
