import 'package:freezed_annotation/freezed_annotation.dart';

part 'poultry_order.freezed.dart';
part 'poultry_order.g.dart';

@freezed
abstract class PoultryOrder with _$PoultryOrder {
  const factory PoultryOrder({
    String? key,
    int? id,
    Poultry? poultry,
    int? orderCode,
    String? createDate,
    String? sendDate,
    List<String>? killHouseList,
    int? firstQuantity,
    int? quantity,
    bool? directBuying,
    bool? union,
    double? amount,
    String? financialOperation,
    int? remainQuantity,
    @JsonKey(name: "Index_weight") double? indexWeight,
    Hatching? hatching,
    String? finalState,
    int? losses,
    String? provinceState,
    String? stateProcess,
    Registrar? registrar,
    VetFarm? vetFarm,
    bool? freeSaleInProvince,
    bool? freezing,
    bool? export,
    String? cityCheckRequest,
    bool? market,
  }) = _PoultryOrder;

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

@freezed
abstract class Poultry with _$Poultry {
  const factory Poultry({
    String? unitName,
    String? cityOperator,
    User? user,
    int? totalCapacity,
    Address? address,
    String? breedingUniqueId,
    String? systemCode,
  }) = _Poultry;

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

@freezed
abstract class User with _$User {
  const factory User({
    String? fullName,
    String? firstName,
    String? lastName,
    int? baseOrder,
    String? mobile,
    String? nationalId,
    String? nationalCode,
    String? key,
    City? city,
    String? unitName,
    String? unitNationalId,
    String? unitRegistrationNumber,
    String? unitEconomicalNumber,
    String? unitProvince,
    String? unitCity,
    String? unitPostalCode,
    String? unitAddress,
  }) = _User;

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

@freezed
abstract class City with _$City {
  const factory City({
    int? id,
    String? key,
    String? createDate,
    String? modifyDate,
    bool? trash,
    int? provinceIdForeignKey,
    int? cityIdKey,
    String? name,
    double? productPrice,
    bool? provinceCenter,
    int? cityNumber,
    String? cityName,
    int? provinceNumber,
    String? provinceName,
    dynamic createdBy,
    dynamic modifiedBy,
    int? province,
  }) = _City;

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

@freezed
abstract class Address with _$Address {
  const factory Address({Province? province, City? city, String? address, String? postalCode}) =
      _Address;

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

@freezed
abstract class Province with _$Province {
  const factory Province({String? key, String? name}) = _Province;

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

@freezed
abstract class Hatching with _$Hatching {
  const factory Hatching({
    int? age,
    int? leftOver,
    String? fileState,
    String? hatchingDate,
    String? allowHatching,
    int? inspectionLosses,
    double? inspectionLossesPercent,
    double? totalLossesPercent,
    double? poultryLossesPercent,
    double? totalWeight,
  }) = _Hatching;

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

@freezed
abstract class Registrar with _$Registrar {
  const factory Registrar({String? date, String? role, String? fullName}) = _Registrar;

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

@freezed
abstract class VetFarm with _$VetFarm {
  const factory VetFarm({String? vetFarmFullName, String? vetFarmMobile}) = _VetFarm;

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