/// 主题模板(对应 web 后台 /theme/themetemplate/* 接口)。 /// /// 用于门店表单中「主题皮肤」选择;门店的 themeId 通常即为模板 id。 class ThemeTemplate { const ThemeTemplate({ required this.id, required this.name, this.description, this.coverUrl, this.status = 'ENABLED', }); /// 模板 ID(对应门店 themeId)。 final String id; /// 模板名称。 final String name; /// 模板描述。 final String? description; /// 封面预览图 URL。 final String? coverUrl; /// 状态:ENABLED / DISABLED。 final String status; factory ThemeTemplate.fromJson(Map json) { return ThemeTemplate( id: json['id']?.toString() ?? json['templateId']?.toString() ?? json['themeTemplateId']?.toString() ?? '', name: json['name']?.toString() ?? json['templateName']?.toString() ?? '', description: json['description']?.toString(), coverUrl: json['coverUrl']?.toString() ?? json['cover_url']?.toString(), status: json['status']?.toString() ?? 'ENABLED', ); } Map toJson() { return { 'id': id, 'name': name, if (description != null) 'description': description, if (coverUrl != null) 'coverUrl': coverUrl, 'status': status, }; } bool get isEnabled => status.toUpperCase() == 'ENABLED'; }