interface ApiConfig {
  BASE_URL: string;
  ENDPOINTS: Record<string, string>;
  DEFAULT_HEADERS: Record<string, string>;
  TIMEOUT: number;
}

const API_CONFIG: ApiConfig = {
  BASE_URL: import.meta.env.VITE_FRAPPE_BASE_URL || 'http://172.25.161.96:8000',
  ENDPOINTS: {
    LOGIN: '/api/method/login',
    RESET_PASSWORD: '/api/method/frappe.core.doctype.user.user.reset_password',
    LOGOUT: '/api/method/logout',
    CSRF_TOKEN: '/api/method/frappe.sessions.get_csrf_token',
    TWO_FACTOR_STATUS: '/api/method/project_management.api.two_factor.get_two_factor_status',
    UPLOAD_FILE: '/api/method/upload_file',
    GET_USER_PERMISSIONS: '/api/method/asset_lite.api.userperm_api.get_user_permissions',
    GET_PERMISSION_FILTERS: '/api/method/asset_lite.api.userperm_api.get_permission_filters',
    GET_ALLOWED_VALUES: '/api/method/asset_lite.api.userperm_api.get_allowed_values',
    CHECK_DOCUMENT_ACCESS: '/api/method/asset_lite.api.userperm_api.check_document_access',
    GET_CONFIGURED_DOCTYPES: '/api/method/asset_lite.api.userperm_api.get_configured_doctypes',
    GET_USER_DEFAULTS: '/api/method/asset_lite.api.userperm_api.get_user_defaults',
  },
  DEFAULT_HEADERS: {
    'Content-Type': 'application/json',
    Accept: 'application/json',
  },
  TIMEOUT: parseInt(import.meta.env.VITE_API_TIMEOUT || '60000'),
};

export default API_CONFIG;
