package repository

import (
	"context"

	"haixun-backend/internal/model/permission/domain/entity"
)

type PermissionFilter struct {
	Status entity.Status
	Type   entity.Type
}

type PermissionRepository interface {
	EnsureIndexes(ctx context.Context) error
	UpsertByName(ctx context.Context, permission *entity.Permission) error
	List(ctx context.Context, filter PermissionFilter) ([]*entity.Permission, error)
	ListByIDs(ctx context.Context, ids []string) ([]*entity.Permission, error)
}

type RolePermissionRepository interface {
	EnsureIndexes(ctx context.Context) error
	ListByRoles(ctx context.Context, tenantID string, roleKeys []string) ([]*entity.RolePermission, error)
	SetForRole(ctx context.Context, tenantID, roleKey string, permissionIDs []string) error
}
