package processor

import (
	"context"
	"eslogad-be/internal/entities"

	"github.com/google/uuid"
)

type UserRepository interface {
	Create(ctx context.Context, user *entities.User) error
	GetByID(ctx context.Context, id uuid.UUID) (*entities.User, error)
	GetByEmail(ctx context.Context, email string) (*entities.User, error)
	GetByRole(ctx context.Context, role entities.UserRole) ([]*entities.User, error)
	GetActiveUsers(ctx context.Context, organizationID uuid.UUID) ([]*entities.User, error)
	Update(ctx context.Context, user *entities.User) error
	Delete(ctx context.Context, id uuid.UUID) error
	UpdatePassword(ctx context.Context, id uuid.UUID, passwordHash string) error
	UpdateActiveStatus(ctx context.Context, id uuid.UUID, isActive bool) error
	List(ctx context.Context, filters map[string]interface{}, limit, offset int) ([]*entities.User, int64, error)
	Count(ctx context.Context, filters map[string]interface{}) (int64, error)

	GetRolesByUserID(ctx context.Context, userID uuid.UUID) ([]entities.Role, error)
	GetPermissionsByUserID(ctx context.Context, userID uuid.UUID) ([]entities.Permission, error)
	GetDepartmentsByUserID(ctx context.Context, userID uuid.UUID) ([]entities.Department, error)

	// New optimized helpers
	GetRolesByUserIDs(ctx context.Context, userIDs []uuid.UUID) (map[uuid.UUID][]entities.Role, error)
	ListWithFilters(ctx context.Context, search *string, roleCode *string, isActive *bool, limit, offset int) ([]*entities.User, int64, error)
}
