import { BaseService } from '@/lib/services/core'; import type { CreateSystemConfigRequest, SystemConfig, UpdateSystemConfigRequest, } from './types'; export class AdminSystemConfigService extends BaseService { protected static readonly basePath = '/api/v1/admin'; static async createSystemConfig( request: CreateSystemConfigRequest, ): Promise { return this.post('/system-configs', request); } static async listSystemConfigs( type?: 'system' | 'business', ): Promise { const query = type ? `?type=${type}` : ''; return this.get(`/system-configs${query}`); } static async getSystemConfig(key: string): Promise { return this.get(`/system-configs/${key}`); } static async updateSystemConfig( key: string, request: UpdateSystemConfigRequest, ): Promise { return this.put(`/system-configs/${key}`, request); } static async testSMTP(request: { smtp_host: string; smtp_port: number; smtp_username: string; smtp_password: string; to: string; }): Promise<{ success: boolean; log: string; error: string }> { return this.post<{ success: boolean; log: string; error: string }>( '/system-configs/smtp/test', request, ); } static async listUploadTypes(): Promise { return this.get('/uploads/types'); } }