package de.oaa.libredeck.web.service.spotify;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.SessionScope;

@Getter
@Setter
@Component
@SessionScope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class SpotifyTokenStore {

    private String accessToken;
    private String refreshToken;
    private long   expiresAt;

    public boolean hasValidToken() {
        return accessToken != null && System.currentTimeMillis() < expiresAt;
    }
}
