import 'package:freezed_annotation/freezed_annotation.dart';

part 'livestock_model.freezed.dart';
part 'livestock_model.g.dart';

@freezed
abstract class LivestockData with _$LivestockData {
  const factory LivestockData({Rancher? rancher, Herd? herd, List<Livestock>? livestock}) =
      _LivestockData;

  factory LivestockData.fromJson(Map<String, dynamic> json) => _$LivestockDataFromJson(json);
}

@freezed
abstract class Rancher with _$Rancher {
  const factory Rancher({String? name, String? phone, String? image}) = _Rancher;

  factory Rancher.fromJson(Map<String, dynamic> json) => _$RancherFromJson(json);
}

@freezed
abstract class Herd with _$Herd {
  const factory Herd({Location? location, String? address, String? image}) = _Herd;

  factory Herd.fromJson(Map<String, dynamic> json) => _$HerdFromJson(json);
}

@freezed
abstract class Location with _$Location {
  const factory Location({double? lat, double? lng}) = _Location;

  factory Location.fromJson(Map<String, dynamic> json) => _$LocationFromJson(json);
}

@freezed
abstract class Livestock with _$Livestock {
  const factory Livestock({
    String? species,
    String? breed,
    String? dateOfBirth,
    String? sex,
    String? motherTag,
    String? fatherTag,
    String? tagNumber,
    String? tagType,
    String? image,
  }) = _Livestock;

  factory Livestock.fromJson(Map<String, dynamic> json) => _$LivestockFromJson(json);
}
