package ports

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

type CourseStore interface {
	// Course Categories
	CreateCourseCategory(
		ctx context.Context,
		name string,
	) (domain.CourseCategory, error)
	GetCourseCategoryByID(
		ctx context.Context,
		id int64,
	) (domain.CourseCategory, error)
	GetAllCourseCategories(
		ctx context.Context,
		limit int32,
		offset int32,
	) ([]domain.CourseCategory, int64, error)
	UpdateCourseCategory(
		ctx context.Context,
		id int64,
		name *string,
		isActive *bool,
	) error
	DeleteCourseCategory(
		ctx context.Context,
		id int64,
	) error

	// Courses
	CreateCourse(
		ctx context.Context,
		categoryID int64,
		title string,
		description *string,
		thumbnail *string,
	) (domain.Course, error)
	GetCourseByID(
		ctx context.Context,
		id int64,
	) (domain.Course, error)
	GetCoursesByCategory(
		ctx context.Context,
		categoryID int64,
		limit int32,
		offset int32,
	) ([]domain.Course, int64, error)
	UpdateCourse(
		ctx context.Context,
		id int64,
		title *string,
		description *string,
		thumbnail *string,
		isActive *bool,
	) error
	DeleteCourse(
		ctx context.Context,
		id int64,
	) error

	// Sub-courses
	CreateSubCourse(
		ctx context.Context,
		courseID int64,
		title string,
		description *string,
		thumbnail *string,
		displayOrder *int32,
		level string,
	) (domain.SubCourse, error)
	GetSubCourseByID(
		ctx context.Context,
		id int64,
	) (domain.SubCourse, error)
	GetSubCoursesByCourse(
		ctx context.Context,
		courseID int64,
	) ([]domain.SubCourse, int64, error)
	ListSubCoursesByCourse(
		ctx context.Context,
		courseID int64,
	) ([]domain.SubCourse, error)
	ListActiveSubCourses(
		ctx context.Context,
	) ([]domain.SubCourse, error)
	UpdateSubCourse(
		ctx context.Context,
		id int64,
		title *string,
		description *string,
		thumbnail *string,
		displayOrder *int32,
		level *string,
		isActive *bool,
	) error
	DeactivateSubCourse(
		ctx context.Context,
		id int64,
	) error
	DeleteSubCourse(
		ctx context.Context,
		id int64,
	) (domain.SubCourse, error)

	// Sub-course Videos
	CreateSubCourseVideo(
		ctx context.Context,
		subCourseID int64,
		title string,
		description *string,
		videoURL string,
		duration int32,
		resolution *string,
		instructorID *string,
		thumbnail *string,
		visibility *string,
		displayOrder *int32,
		status *string,
		vimeoID *string,
		vimeoEmbedURL *string,
		vimeoPlayerHTML *string,
		vimeoStatus *string,
		videoHostProvider *string,
	) (domain.SubCourseVideo, error)
	GetSubCourseVideoByID(
		ctx context.Context,
		id int64,
	) (domain.SubCourseVideo, error)
	GetVideosBySubCourse(
		ctx context.Context,
		subCourseID int64,
	) ([]domain.SubCourseVideo, int64, error)
	GetPublishedVideosBySubCourse(
		ctx context.Context,
		subCourseID int64,
	) ([]domain.SubCourseVideo, error)
	PublishSubCourseVideo(
		ctx context.Context,
		videoID int64,
	) error
	UpdateSubCourseVideo(
		ctx context.Context,
		id int64,
		title *string,
		description *string,
		videoURL *string,
		duration *int32,
		resolution *string,
		visibility *string,
		thumbnail *string,
		displayOrder *int32,
		status *string,
	) error
	ArchiveSubCourseVideo(
		ctx context.Context,
		id int64,
	) error
	DeleteSubCourseVideo(
		ctx context.Context,
		id int64,
	) error

	// Vimeo integration
	UpdateVimeoStatus(ctx context.Context, videoID int64, status string) error
	GetVideoByVimeoID(ctx context.Context, vimeoID string) (domain.SubCourseVideo, error)

	// Learning Tree
	GetFullLearningTree(ctx context.Context) ([]domain.TreeCourse, error)
}
