import applicationConfig from '@/constants/application-config.js';
import { convertToSeconds } from '@/helpers/date-helper.js';

/**
 * @module cookieNames
 * @requires applicationConfig
 * @author T-Wrecks Team
 * @copyright Safelite
 */
const cookieNames = Object.freeze({
    ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,
    ISS_SESSION_KEY: `ISSSessionKey-${applicationConfig.CURRENT_ENVIRONMENT}`,
    ISS_USER_ID: `ISSUserId-${applicationConfig.CURRENT_ENVIRONMENT}`,

    // Existing Safelite.com cookies
    DXDEV: 'dxdev',
    SESSION_ID: 'sid',
    SESSION_KEY: 'skey'
});

const cookieExpirations = Object.freeze({
    SESSION_ID: convertToSeconds({ minutes: 30 }),
    DXDEV: convertToSeconds({ years: 1 }),
    ISS_USER_ID: convertToSeconds({ weeks: 1 }),
    ISS_SESSION_KEY: convertToSeconds({ minutes: 30 })
});

export { cookieNames, cookieExpirations };
