package admin

import (
	"context"
	v1 "github.com/go-nunu/nunu-layout-advanced/api/v1"
	admin "github.com/go-nunu/nunu-layout-advanced/api/v1/admin"
	"github.com/go-nunu/nunu-layout-advanced/internal/model"
	adminRep "github.com/go-nunu/nunu-layout-advanced/internal/repository/admin"
	"github.com/go-nunu/nunu-layout-advanced/internal/service"
)

type LogService interface {
	GetLog(ctx context.Context, id int64) (*model.Log, error)
	GetLogList(ctx context.Context, req admin.SearchLogParams) (*v1.PaginatedResponse[model.Log], error)
}
func NewLogService(
    service *service.Service,
    LogRepository adminRep.LogRepository,
) LogService {
	return &logService{
		Service:        service,
		LogRepository: LogRepository,
	}
}

type logService struct {
	*service.Service
	LogRepository adminRep.LogRepository
}

func (s *logService) GetLog(ctx context.Context, id int64) (*model.Log, error) {
	return s.LogRepository.GetLog(ctx, id)
}

func (s *logService) GetLogList(ctx context.Context, req admin.SearchLogParams) (*v1.PaginatedResponse[model.Log], error) {
	return s.LogRepository.GetLogList(ctx, req)
}
