import axios from 'axios' import type { Tenant, TenantUpdateRequest, TenantUpdateResponse, TenantListResponse, TenantCreateRequest, TenantCreateResponse, } from '../types/tenant' const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:10181' class TenantService { /** * Get all tenants */ async getTenants(): Promise { const response = await axios.get( `${API_BASE_URL}/api/v1/tenants` ) return response.data } /** * Get tenant information by ID */ async getTenant(tenantId: number): Promise { const response = await axios.get( `${API_BASE_URL}/api/v1/tenants/${tenantId}` ) return response.data } /** * Create new tenant */ async createTenant(data: TenantCreateRequest): Promise { const response = await axios.post( `${API_BASE_URL}/api/v1/tenants`, data ) return response.data } /** * Update tenant information */ async updateTenant( tenantId: number, data: TenantUpdateRequest ): Promise { const response = await axios.put( `${API_BASE_URL}/api/v1/tenants/${tenantId}`, data ) return response.data } } export const tenantService = new TenantService()