const std = @import("std"); const Store = @import("../store.zig"); const json_utils = @import("../json_utils.zig"); const json = std.json; const Allocator = std.mem.Allocator; const Cooldown = @import("./cooldown.zig"); const Character = @import("./character.zig"); const SkillInfo = @import("./skill_info.zig"); const SkillData = @This(); cooldown: Cooldown, details: SkillInfo, character: Character, pub fn parse(store: *Store, obj: json.ObjectMap, allocator: Allocator) !SkillData { const cooldown = json_utils.getObject(obj, "cooldown") orelse return error.MissingProperty; const details = json_utils.getObject(obj, "details") orelse return error.MissingProperty; const character = json_utils.getObject(obj, "character") orelse return error.MissingProperty; return SkillData{ .cooldown = try Cooldown.parse(cooldown), .details = try SkillInfo.parse(store, details), .character = try Character.parse(store, character, allocator) }; }