/**
 * Configuração da API
 * Compatível com backend Spring Boot
 */

export const API_CONFIG = {
  baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8081/api',
  timeout: 30000,
  headers: {
    'Content-Type': 'application/json',
  },
};

// Endpoints da API
export const API_ENDPOINTS = {
  // RH Module
  agents: {
    list: '/rh/agents',
    get: (id: string) => `/rh/agents/${id}`,
    create: '/rh/agents',
    update: (id: string) => `/rh/agents/${id}`,
    delete: (id: string) => `/rh/agents/${id}`,
  },
  // Admin Module
  users: {
    list: '/admin/users',
    get: (id: string) => `/admin/users/${id}`,
    create: '/admin/users',
    update: (id: string) => `/admin/users/${id}`,
    delete: (id: string) => `/admin/users/${id}`,
  },
  // Org Module
  ministries: {
    list: '/org/ministries',
    get: (id: string) => `/org/ministries/${id}`,
    create: '/org/ministries',
    update: (id: string) => `/org/ministries/${id}`,
  },
  orgUnits: {
    list: '/org/org-units',
    get: (id: string) => `/org/org-units/${id}`,
    create: '/org/org-units',
    update: (id: string) => `/org/org-units/${id}`,
  },
  positions: {
    list: '/org/positions',
    get: (id: string) => `/org/positions/${id}`,
    create: '/org/positions',
    update: (id: string) => `/org/positions/${id}`,
  },
  // Budget Module
  fiscalYears: {
    list: '/budget/fiscal-years',
    get: (id: string) => `/budget/fiscal-years/${id}`,
    create: '/budget/fiscal-years',
    update: (id: string) => `/budget/fiscal-years/${id}`,
  },
  // Treasury Module
  paymentBatches: {
    list: '/treasury/payment-batches',
    get: (id: string) => `/treasury/payment-batches/${id}`,
    create: '/treasury/payment-batches',
  },
  // Common Module
  banks: {
    list: '/common/banks',
    get: (id: string) => `/common/banks/${id}`,
    create: '/common/banks',
    update: (id: string) => `/common/banks/${id}`,
  },
};

