class Idea { final String id; final String title; final String description; final String? funnelStatus; final String? workspaceId; final String userId; final String userName; final int upvotes; final int downvotes; final int commentCount; final DateTime createdAt; final DateTime updatedAt; Idea({ required this.id, required this.title, required this.description, this.funnelStatus, this.workspaceId, required this.userId, this.userName = '', this.upvotes = 0, this.downvotes = 0, this.commentCount = 0, required this.createdAt, required this.updatedAt, }); factory Idea.fromJson(Map json) => Idea( id: json['id'] as String, title: json['title'] as String, description: json['description'] as String? ?? '', funnelStatus: json['funnel_status'] as String?, workspaceId: json['workspace_id'] as String?, userId: json['user_id'] as String? ?? '', userName: json['user_name'] as String? ?? '', upvotes: json['upvotes'] as int? ?? 0, downvotes: json['downvotes'] as int? ?? 0, commentCount: json['comment_count'] as int? ?? 0, createdAt: DateTime.parse(json['created_at'] as String), updatedAt: DateTime.parse(json['updated_at'] as String), ); Map toJson() => { 'id': id, 'title': title, 'description': description, 'funnel_status': funnelStatus, 'workspace_id': workspaceId, 'user_id': userId, 'user_name': userName, 'upvotes': upvotes, 'downvotes': downvotes, 'comment_count': commentCount, 'created_at': createdAt.toIso8601String(), 'updated_at': updatedAt.toIso8601String(), }; Idea copyWith({ String? title, String? description, String? funnelStatus, int? upvotes, int? downvotes, int? commentCount, }) => Idea( id: id, title: title ?? this.title, description: description ?? this.description, funnelStatus: funnelStatus ?? this.funnelStatus, workspaceId: workspaceId, userId: userId, userName: userName, upvotes: upvotes ?? this.upvotes, downvotes: downvotes ?? this.downvotes, commentCount: commentCount ?? this.commentCount, createdAt: createdAt, updatedAt: updatedAt, ); } class CreateIdeaRequest { final String title; final String description; final String? workspaceId; CreateIdeaRequest({ required this.title, required this.description, this.workspaceId, }); Map toJson() => { 'title': title, 'description': description, 'workspace_id': workspaceId, }; } class UpdateIdeaRequest { final String? title; final String? description; UpdateIdeaRequest({this.title, this.description}); Map toJson() => { if (title != null) 'title': title, if (description != null) 'description': description, }; } class FunnelTransitionRequest { final String status; FunnelTransitionRequest({required this.status}); Map toJson() => {'status': status}; }