// Package services provides service client interfaces for inter-service communication.
package services

import (
	"context"
)

// AuthServiceClient is the interface for communicating with the Auth Service.
type AuthServiceClient interface {
	// Login authenticates a user and returns access and refresh tokens.
	Login(ctx context.Context, email, password string) (*TokenResponse, error)

	// RefreshToken refreshes an access token using a refresh token.
	RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)

	// ValidateToken validates a JWT token and returns the token claims.
	ValidateToken(ctx context.Context, token string) (*TokenClaims, error)

	// Logout invalidates a refresh token.
	Logout(ctx context.Context, refreshToken string) error
}

// TokenResponse contains the authentication tokens.
type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int64  `json:"expires_in"` // seconds
	TokenType    string `json:"token_type"` // "Bearer"
}

// TokenClaims contains the claims from a validated JWT token.
type TokenClaims struct {
	UserID    string   `json:"user_id"`
	Email     string   `json:"email"`
	Roles     []string `json:"roles"`
	ExpiresAt int64    `json:"expires_at"`
}
