package services import ( "context" "github.com/google/uuid" "github.com/kms/api-key-service/internal/domain" ) // ApplicationService defines the interface for application business logic type ApplicationService interface { // Create creates a new application Create(ctx context.Context, req *domain.CreateApplicationRequest, userID string) (*domain.Application, error) // GetByID retrieves an application by its ID GetByID(ctx context.Context, appID string) (*domain.Application, error) // List retrieves applications with pagination List(ctx context.Context, limit, offset int) ([]*domain.Application, error) // Update updates an existing application Update(ctx context.Context, appID string, updates *domain.UpdateApplicationRequest, userID string) (*domain.Application, error) // Delete deletes an application Delete(ctx context.Context, appID string, userID string) error } // TokenService defines the interface for token business logic type TokenService interface { // CreateStaticToken creates a new static token CreateStaticToken(ctx context.Context, req *domain.CreateStaticTokenRequest, userID string) (*domain.CreateStaticTokenResponse, error) // ListByApp lists all tokens for an application ListByApp(ctx context.Context, appID string, limit, offset int) ([]*domain.StaticToken, error) // Delete deletes a token Delete(ctx context.Context, tokenID uuid.UUID, userID string) error // GenerateUserToken generates a user token GenerateUserToken(ctx context.Context, appID, userID string, permissions []string) (string, error) // VerifyToken verifies a token and returns verification response VerifyToken(ctx context.Context, req *domain.VerifyRequest) (*domain.VerifyResponse, error) // RenewUserToken renews a user token RenewUserToken(ctx context.Context, req *domain.RenewRequest) (*domain.RenewResponse, error) } // AuthenticationService defines the interface for authentication business logic type AuthenticationService interface { // GetUserID extracts user ID from context GetUserID(ctx context.Context) (string, error) // ValidatePermissions checks if user has required permissions ValidatePermissions(ctx context.Context, userID string, appID string, requiredPermissions []string) error // GetUserClaims retrieves user claims GetUserClaims(ctx context.Context, userID string) (map[string]string, error) }