/* eslint-disable */
import { api } from 'src/boot/axios';

export const AuthService = {
    // Will likely be deprecated and relegated to Authentik
    login: () => {
        //TODO: OIDC customer sign-in, eventually
    },

    oidcLogin: (): Window | null => {
        window.addEventListener('message', (event) => {
            if (event.data.type === 'authSuccess') {
                //some kind of logic here to set user in store
            }
        })
        
        return window.open('http://localhost:3000/auth/v1/login', 'authPopup', 'width=600,height=800');
    },

    logout: () => {
        // TODO: logout logic
        api.post('/auth/logout')
    },

    refreshToken: () => {
        // TODO: token refresh logic
        api.post('/auth/refresh')
    },

    getProfile: () => {
        // TODO: user info fetch logic
        api.get('/auth/me')
    },
};
