import 'dart:convert';
import 'package:hive/hive.dart';
import 'package:hello_wallpaper/generated/json/base/json_field.dart';
import 'package:hello_wallpaper/generated/json/wallpaper_model.g.dart';

part 'wallpaper_model.g.dart';

@JsonSerializable()
class WallpaperModel {
	List<WallpaperData>? data;
	String? name;

	WallpaperModel();

	factory WallpaperModel.fromJson(Map<String, dynamic> json) => $WallpaperModelFromJson(json);

	Map<String, dynamic> toJson() => $WallpaperModelToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}

@HiveType(typeId: 1)
@JsonSerializable()
class WallpaperData extends HiveObject{
	@HiveField(0)
	String? banner;

	@HiveField(1)
	String? original;

	@HiveField(2)
	String? previewThumb;

	@HiveField(3)
	String? source;

	WallpaperData();

	factory WallpaperData.fromJson(Map<String, dynamic> json) => $WallpaperDataFromJson(json);

	Map<String, dynamic> toJson() => $WallpaperDataToJson(this);

	@override
	String toString() {
		return jsonEncode(this);
	}
}