/// <reference path="../.astro/types.d.ts" />

import type PocketBase from 'pocketbase';
import type { RecordModel } from 'pocketbase';

// 1. Описание переменных окружения (.env)
interface ImportMetaEnv {
    readonly POCKETBASE_URL: string;

    // Настройки почты
    readonly MAIL_HOST: string;
    readonly MAIL_PORT: string;
    readonly MAIL_FROM: string;
    readonly ADMIN_EMAIL: string;
    readonly SENDER_EMAIL: string;
    readonly PROD: string;
}

interface ImportMeta {
    readonly env: ImportMetaEnv;
}

// 2. Глобальные типы Astro
declare namespace App {
    interface Locals {
        pb: PocketBase;
        user: RecordModel | null;
    }
}

// 3. Расширение window для глобальных функций
declare global {
    interface Window {
        closeModal?: (modalId: string) => void;
        currentSelectedCar?: unknown;
    }
}