import { apiClient } from './client'; export interface Tenant { id: string; nombre: string; rfc: string; plan: string; schemaName: string; createdAt: string; _count?: { users: number; }; } export interface CreateTenantData { nombre: string; rfc: string; plan?: 'starter' | 'business' | 'professional' | 'enterprise'; cfdiLimit?: number; usersLimit?: number; } export async function getTenants(): Promise { const response = await apiClient.get('/tenants'); return response.data; } export async function getTenant(id: string): Promise { const response = await apiClient.get(`/tenants/${id}`); return response.data; } export async function createTenant(data: CreateTenantData): Promise { const response = await apiClient.post('/tenants', data); return response.data; } export interface UpdateTenantData { nombre?: string; rfc?: string; plan?: 'starter' | 'business' | 'professional' | 'enterprise'; cfdiLimit?: number; usersLimit?: number; active?: boolean; } export async function updateTenant(id: string, data: UpdateTenantData): Promise { const response = await apiClient.put(`/tenants/${id}`, data); return response.data; } export async function deleteTenant(id: string): Promise { await apiClient.delete(`/tenants/${id}`); }