import 'entity.dart'; /// 分类项 class CategoryItem extends Entity { CategoryItem({ this.id, this.name, this.icon, }); final int? id; final String? name; final String? icon; @override factory CategoryItem.fromJson(Map json) { return CategoryItem( id: json['id'] as int?, name: json['name'] as String?, icon: json['icon'] as String?, ); } @override Map toJson() => { 'id': id, 'name': name, 'icon': icon, }; } /// 分类列表响应 class CategoryListResponse extends Entity { CategoryListResponse({ this.categories, }); final List? categories; @override factory CategoryListResponse.fromJson(Map json) { final list = json['categories'] as List?; return CategoryListResponse( categories: list ?.map((e) => CategoryItem.fromJson(e as Map)) .toList(), ); } @override Map toJson() => { 'categories': categories?.map((e) => e.toJson()).toList(), }; } /// 任务项 class TaskItem extends Entity { TaskItem({ this.id, this.name, this.imageUrl, this.categoryId, }); final String? id; final String? name; final String? imageUrl; final int? categoryId; @override factory TaskItem.fromJson(Map json) { return TaskItem( id: json['id'] as String?, name: json['name'] as String?, imageUrl: json['imageUrl'] as String?, categoryId: json['categoryId'] as int?, ); } @override Map toJson() => { 'id': id, 'name': name, 'imageUrl': imageUrl, 'categoryId': categoryId, }; } /// 任务列表响应 class TasksResponse extends Entity { TasksResponse({ this.tasks, }); final List? tasks; @override factory TasksResponse.fromJson(Map json) { final list = json['tasks'] as List?; return TasksResponse( tasks: list ?.map((e) => TaskItem.fromJson(e as Map)) .toList(), ); } @override Map toJson() => { 'tasks': tasks?.map((e) => e.toJson()).toList(), }; } /// 推荐提示词项 class PromptRecommendItem extends Entity { PromptRecommendItem({ this.prompt, this.icon, }); final String? prompt; final String? icon; @override factory PromptRecommendItem.fromJson(Map json) { return PromptRecommendItem( prompt: json['prompt'] as String?, icon: json['icon'] as String?, ); } @override Map toJson() => { 'prompt': prompt, 'icon': icon, }; } /// 推荐提示词响应 class PromptRecommendsResponse extends Entity { PromptRecommendsResponse({ this.recommends, }); final List? recommends; @override factory PromptRecommendsResponse.fromJson(Map json) { final list = json['recommends'] as List?; return PromptRecommendsResponse( recommends: list ?.map((e) => PromptRecommendItem.fromJson(e as Map)) .toList(), ); } @override Map toJson() => { 'recommends': recommends?.map((e) => e.toJson()).toList(), }; } /// 任务进度响应 class ProgressResponse extends Entity { ProgressResponse({ this.taskId, this.status, this.progress, this.resultUrl, }); final String? taskId; final String? status; final int? progress; final String? resultUrl; @override factory ProgressResponse.fromJson(Map json) { return ProgressResponse( taskId: json['taskId'] as String?, status: json['status'] as String?, progress: json['progress'] as int?, resultUrl: json['resultUrl'] as String?, ); } @override Map toJson() => { 'taskId': taskId, 'status': status, 'progress': progress, 'resultUrl': resultUrl, }; } /// 姿态模板项 class PoseTemplateItem extends Entity { PoseTemplateItem({ this.id, this.name, this.imageUrl, }); final String? id; final String? name; final String? imageUrl; @override factory PoseTemplateItem.fromJson(Map json) { return PoseTemplateItem( id: json['id'] as String?, name: json['name'] as String?, imageUrl: json['imageUrl'] as String?, ); } @override Map toJson() => { 'id': id, 'name': name, 'imageUrl': imageUrl, }; } /// 姿态模板列表响应 class PoseTemplatesResponse extends Entity { PoseTemplatesResponse({ this.templates, }); final List? templates; @override factory PoseTemplatesResponse.fromJson(Map json) { final list = json['templates'] as List?; return PoseTemplatesResponse( templates: list ?.map((e) => PoseTemplateItem.fromJson(e as Map)) .toList(), ); } @override Map toJson() => { 'templates': templates?.map((e) => e.toJson()).toList(), }; } /// 预签名上传 URL 响应 class UploadPresignedUrlResponse extends Entity { UploadPresignedUrlResponse({ this.uploadUrl, this.filePath, }); final String? uploadUrl; final String? filePath; @override factory UploadPresignedUrlResponse.fromJson(Map json) { return UploadPresignedUrlResponse( uploadUrl: json['uploadUrl'] as String?, filePath: json['filePath'] as String?, ); } @override Map toJson() => { 'uploadUrl': uploadUrl, 'filePath': filePath, }; } /// 创建任务响应 class CreateTaskResponse extends Entity { CreateTaskResponse({ this.taskId, this.status, }); final String? taskId; final String? status; @override factory CreateTaskResponse.fromJson(Map json) { return CreateTaskResponse( taskId: json['taskId'] as String?, status: json['status'] as String?, ); } @override Map toJson() => { 'taskId': taskId, 'status': status, }; } /// 我的任务项 class MyTaskItem extends Entity { MyTaskItem({ this.taskId, this.status, this.progress, this.resultUrl, this.createTime, this.type, }); final String? taskId; final String? status; final int? progress; final String? resultUrl; final String? createTime; final String? type; @override factory MyTaskItem.fromJson(Map json) { return MyTaskItem( taskId: json['taskId'] as String?, status: json['status'] as String?, progress: json['progress'] as int?, resultUrl: json['resultUrl'] as String?, createTime: json['createTime'] as String?, type: json['type'] as String?, ); } @override Map toJson() => { 'taskId': taskId, 'status': status, 'progress': progress, 'resultUrl': resultUrl, 'createTime': createTime, 'type': type, }; } /// 我的任务列表响应 class MyTasksResponse extends Entity { MyTasksResponse({ this.tasks, this.total, this.cursor, }); final List? tasks; final int? total; final String? cursor; @override factory MyTasksResponse.fromJson(Map json) { final list = json['tasks'] as List?; return MyTasksResponse( tasks: list ?.map((e) => MyTaskItem.fromJson(e as Map)) .toList(), total: json['total'] as int?, cursor: json['cursor'] as String?, ); } @override Map toJson() => { 'tasks': tasks?.map((e) => e.toJson()).toList(), 'total': total, 'cursor': cursor, }; } /// 积分页面信息响应 class CreditsPageInfoResponse extends Entity { CreditsPageInfoResponse({ this.credits, this.freeTimes, this.vipExpireTime, this.isVip, }); final int? credits; final int? freeTimes; final String? vipExpireTime; final bool? isVip; @override factory CreditsPageInfoResponse.fromJson(Map json) { return CreditsPageInfoResponse( credits: json['credits'] as int?, freeTimes: json['freeTimes'] as int?, vipExpireTime: json['vipExpireTime'] as String?, isVip: json['isVip'] as bool?, ); } @override Map toJson() => { 'credits': credits, 'freeTimes': freeTimes, 'vipExpireTime': vipExpireTime, 'isVip': isVip, }; }