"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logout = logout;
const config_1 = require("../config");
function logout(options = {}) {
    const current = (0, config_1.getCurrentAccountSession)();
    const username = options.username?.trim() || current?.username || '';
    const env = options.env?.trim() || current?.env || '';
    const existingSession = username ? (0, config_1.findAccountSession)(username, env || undefined) : null;
    if (!existingSession) {
        if (username && env) {
            console.log(`No stored session found for ${username} on ${env}.`);
        }
        else if (username) {
            console.log(`No stored session found for ${username}.`);
        }
        else {
            console.log('No stored session found.');
        }
        console.log('Next: run "playdrop auth login" when you need a new session.');
        return;
    }
    (0, config_1.removeAccountSession)({ username, env });
    if (username && env) {
        console.log(`Logged out ${username} on ${env}.`);
    }
    else {
        console.log('Logged out.');
    }
    console.log('Next: run "playdrop auth login" when you need a new session.');
}
