import { http } from '../http' export interface TrialInfo { active: boolean; daysLeft: number } export interface LicenseInfo { trial?: TrialInfo plan: 'free' | 'pro' edition?: string instances?: number customer?: string expiresAt?: number expired?: boolean source?: 'hmac' | 'opsx' | string planType?: string maxDevices?: number deprecationNotice?: string inGrace?: boolean graceDaysLeft?: number lastVerifiedAt?: number instanceId?: string /** expired | over_instance | revoked — 非有效 Pro 时红条 */ invalidReason?: 'expired' | 'over_instance' | 'revoked' | string } export const licenseApi = { status: () => http.get<{ license: LicenseInfo; pro: boolean; features: string[] }>('/system/license'), activate: (key: string) => http.post('/system/license/activate', { key }), deactivate: () => http.post<{ offlineLocalOnly?: boolean; message?: string }>('/system/license/deactivate'), }