class AgentType {
  final String id;
  final String name;
  final String? description;
  final bool isActive;
  final int sortOrder;
  final int agentCount;

  const AgentType({
    required this.id,
    required this.name,
    this.description,
    this.isActive = true,
    this.sortOrder = 0,
    this.agentCount = 0,
  });

  factory AgentType.fromJson(Map<String, dynamic> json) {
    final count = json['_count'] as Map<String, dynamic>?;
    return AgentType(
      id: json['id'] as String,
      name: json['name'] as String,
      description: json['description'] as String?,
      isActive: json['isActive'] as bool? ?? true,
      sortOrder: json['sortOrder'] as int? ?? 0,
      agentCount: count?['agents'] as int? ?? 0,
    );
  }
}
