135 lines
3.6 KiB
Dart
135 lines
3.6 KiB
Dart
class AgentConfig {
|
|
final String name;
|
|
final String description;
|
|
final bool isActive;
|
|
final String schedule;
|
|
final Map<String, dynamic> config;
|
|
|
|
AgentConfig({
|
|
required this.name,
|
|
this.description = '',
|
|
this.isActive = true,
|
|
this.schedule = '',
|
|
this.config = const {},
|
|
});
|
|
|
|
factory AgentConfig.fromJson(Map<String, dynamic> json) => AgentConfig(
|
|
name: json['name'] as String? ?? '',
|
|
description: json['description'] as String? ?? '',
|
|
isActive: json['is_active'] as bool? ?? true,
|
|
schedule: json['schedule'] as String? ?? '',
|
|
config: json['config'] as Map<String, dynamic>? ?? {},
|
|
);
|
|
}
|
|
|
|
class AgentRunResult {
|
|
final String agent;
|
|
final String status;
|
|
final String? message;
|
|
|
|
AgentRunResult({
|
|
required this.agent,
|
|
required this.status,
|
|
this.message,
|
|
});
|
|
|
|
factory AgentRunResult.fromJson(Map<String, dynamic> json) => AgentRunResult(
|
|
agent: json['agent'] as String? ?? '',
|
|
status: json['status'] as String? ?? 'error',
|
|
message: json['message'] as String?,
|
|
);
|
|
}
|
|
|
|
class BotCommand {
|
|
final String id;
|
|
final String command;
|
|
final String description;
|
|
final bool isEnabled;
|
|
|
|
BotCommand({
|
|
required this.id,
|
|
required this.command,
|
|
this.description = '',
|
|
this.isEnabled = true,
|
|
});
|
|
|
|
factory BotCommand.fromJson(Map<String, dynamic> json) => BotCommand(
|
|
id: json['id'] as String,
|
|
command: json['command'] as String,
|
|
description: json['description'] as String? ?? '',
|
|
isEnabled: json['is_enabled'] as bool? ?? true,
|
|
);
|
|
}
|
|
|
|
class LogEntry {
|
|
final String id;
|
|
final String level;
|
|
final String message;
|
|
final String? source;
|
|
final DateTime createdAt;
|
|
|
|
LogEntry({
|
|
required this.id,
|
|
required this.level,
|
|
required this.message,
|
|
this.source,
|
|
required this.createdAt,
|
|
});
|
|
|
|
factory LogEntry.fromJson(Map<String, dynamic> json) => LogEntry(
|
|
id: json['id'] as String,
|
|
level: json['level'] as String? ?? 'INFO',
|
|
message: json['message'] as String,
|
|
source: json['source'] as String?,
|
|
createdAt: DateTime.parse(json['created_at'] as String),
|
|
);
|
|
}
|
|
|
|
class AdminStats {
|
|
final int totalUsers;
|
|
final int totalIdeas;
|
|
final int totalVoiceSessions;
|
|
final int totalWorkspaces;
|
|
final int activeAgents;
|
|
final int totalNotifications;
|
|
|
|
AdminStats({
|
|
this.totalUsers = 0,
|
|
this.totalIdeas = 0,
|
|
this.totalVoiceSessions = 0,
|
|
this.totalWorkspaces = 0,
|
|
this.activeAgents = 0,
|
|
this.totalNotifications = 0,
|
|
});
|
|
|
|
factory AdminStats.fromJson(Map<String, dynamic> json) => AdminStats(
|
|
totalUsers: json['total_users'] as int? ?? 0,
|
|
totalIdeas: json['total_ideas'] as int? ?? 0,
|
|
totalVoiceSessions: json['total_voice_sessions'] as int? ?? 0,
|
|
totalWorkspaces: json['total_workspaces'] as int? ?? 0,
|
|
activeAgents: json['active_agents'] as int? ?? 0,
|
|
totalNotifications: json['total_notifications'] as int? ?? 0,
|
|
);
|
|
}
|
|
|
|
class HealthStatus {
|
|
final String status;
|
|
final String version;
|
|
final double uptimeSeconds;
|
|
final Map<String, dynamic> services;
|
|
|
|
HealthStatus({
|
|
this.status = 'ok',
|
|
this.version = '',
|
|
this.uptimeSeconds = 0,
|
|
this.services = const {},
|
|
});
|
|
|
|
factory HealthStatus.fromJson(Map<String, dynamic> json) => HealthStatus(
|
|
status: json['status'] as String? ?? 'ok',
|
|
version: json['version'] as String? ?? '',
|
|
uptimeSeconds: (json['uptime_seconds'] as num?)?.toDouble() ?? 0,
|
|
services: json['services'] as Map<String, dynamic>? ?? {},
|
|
);
|
|
}
|