import 'package:freezed_annotation/freezed_annotation.dart';

part 'poultry_hatching.freezed.dart';
part 'poultry_hatching.g.dart';

@freezed
abstract class PoultryHatching with _$PoultryHatching {
  const factory PoultryHatching({
    int? id,
    Poultry? poultry,
    ChainCompany? chainCompany,
    int? age,
    dynamic inspectionLosses,
    VetFarm? vetFarm,
    ActiveKill? activeKill,
    KillingInfo? killingInfo,
    FreeGovernmentalInfo? freeGovernmentalInfo,
    ManagementHatchingAgeRange? managementHatchingAgeRange,
    String? key,
    String? createDate,
    String? modifyDate,
    bool? trash,
    bool? hasChainCompany,
    dynamic poultryIdForeignKey,
    dynamic poultryHatchingIdKey,
    int? quantity,
    int? losses,
    int? leftOver,
    int? killedQuantity,
    int? extraKilledQuantity,
    double? governmentalKilledQuantity,
    double? governmentalQuantity,
    double? freeKilledQuantity,
    double? freeQuantity,
    double? chainKilledQuantity,
    double? chainKilledWeight,
    double? outProvinceKilledWeight,
    double? outProvinceKilledQuantity,
    double? exportKilledWeight,
    double? exportKilledQuantity,
    double? totalCommitment,
    String? commitmentType,
    double? totalCommitmentQuantity,
    double? totalFreeCommitmentQuantity,
    double? totalFreeCommitmentWeight,
    double? totalKilledWeight,
    double? totalAverageKilledWeight,
    int? requestLeftOver,
    int? hall,
    String? date,
    dynamic predicateDate,
    String? chickenBreed,
    int? period,
    String? allowHatching,
    String? state,
    bool? archive,
    bool? violation,
    dynamic message,
    Registrar? registrar,
    List<Breed>? breed,
    int? cityNumber,
    String? cityName,
    int? provinceNumber,
    String? provinceName,
    LastChange? lastChange,
    int? chickenAge,
    int? nowAge,
    LatestHatchingChange? latestHatchingChange,
    String? violationReport,
    String? violationMessage,
    List<String>? violationImage,
    String? violationReporter,
    String? violationReportDate,
    String? violationReportEditor,
    String? violationReportEditDate,
    int? totalLosses,
    int? directLosses,
    String? directLossesInputer,
    String? directLossesDate,
    String? directLossesEditor,
    String? directLossesLastEditDate,
    String? endPeriodLossesInputer,
    String? endPeriodLossesDate,
    String? endPeriodLossesEditor,
    String? endPeriodLossesLastEditDate,
    String? breedingUniqueId,
    String? licenceNumber,
    bool? temporaryTrash,
    bool? temporaryDeleted,
    dynamic firstDateInputArchive,
    dynamic secondDateInputArchive,
    dynamic inputArchiver,
    dynamic outputArchiveDate,
    dynamic outputArchiver,
    double? barDifferenceRequestWeight,
    double? barDifferenceRequestQuantity,
    dynamic healthCertificate,
    int? samasatDischargePercentage,
    dynamic personTypeName,
    String? interactTypeName,
    dynamic unionTypeName,
    dynamic certId,
    int? increaseQuantity,
    String? tenantFullname,
    String? tenantNationalCode,
    String? tenantMobile,
    String? tenantCity,
    bool? hasTenant,
    dynamic archiveDate,
    dynamic createdBy,
    dynamic modifiedBy,
  }) = _PoultryHatching;

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

// Sub models
@freezed
abstract class Poultry with _$Poultry {
  const factory Poultry({
    UserProfile? userprofile,
    Address? address,
    dynamic poultryOwner,
    PoultryTenant? poultryTenant,
    List<Hatching>? hatching,
    List<int>? registerVetHalls,
    Allow? allow,
    ProvinceAllowChooseKillHouse? provinceAllowChooseKillHouse,
    bool? provinceAllowSellFree,
    VetFarm? vetFarm,
    LastHatchingDiffrentRequestQuantity? lastHatchingDiffrentRequestQuantity,
    UserBankInfo? userBankInfo,
    int? leftOverOwnHatching,
    String? key,
    bool? trash,
    int? ownerIdForeignKey,
    int? userIdForeignKey,
    int? addressIdForeignKey,
    bool? hasChainCompany,
    int? userBankIdForeignKey,
    String? cityOperator,
    String? unitName,
    String? gisCode,
    int? operatingLicenceCapacity,
    int? numberOfHalls,
    bool? tenant,
    bool? hasTenant,
    dynamic personType,
    dynamic economicCode,
    String? systemCode,
    String? epidemiologicalCode,
    String? breedingUniqueId,
    int? totalCapacity,
    String? licenceNumber,
    String? healthCertificateNumber,
    int? numberOfRequests,
    String? hatchingDate,
    String? lastPartyDate,
    int? numberOfIncubators,
    int? herdAgeByDay,
    int? herdAgeByWeek,
    int? numberOfParty,
    dynamic communicationType,
    dynamic cooperative,
    String? dateOfRegister,
    dynamic unitStatus,
    bool? active,
    dynamic identityDocuments,
    dynamic samasatUserCode,
    dynamic baseOrder,
    String? incubationDate,
    int? walletAmount,
    int? city,
    int? cityNumber,
    String? cityName,
    int? provinceNumber,
    String? provinceName,
    int? walletIdForeignKey,
    int? poultryIdKey,
    double? lat,
    double? long,
    dynamic date,
    int? killingAveAge,
    int? activeLeftOver,
    int? killingAveCount,
    int? killingAveWeight,
    int? killingLiveWeight,
    int? killingCarcassesWeight,
    int? killingLossWeightPercent,
    double? realKillingAveWeight,
    double? realKillingLiveWeight,
    double? realKillingCarcassesWeight,
    double? realKillingLossWeightPercent,
    dynamic interestLicenseId,
    bool? orderLimit,
    dynamic owner,
    int? wallet,
  }) = _Poultry;

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

@freezed
abstract class UserProfile with _$UserProfile {
  const factory UserProfile({
    String? userKey,
    int? baseOrder,
    String? fullName,
    String? mobile,
    String? city,
    String? province,
    String? breedingUniqueId,
  }) = _UserProfile;

  factory UserProfile.fromJson(Map<String, dynamic> json) =>
      _$UserProfileFromJson(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 City with _$City {
  const factory City({
    String? key,
    String? name,
  }) = _City;

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

@freezed
abstract class PoultryTenant with _$PoultryTenant {
  const factory PoultryTenant({
    String? key,
    String? firstName,
    String? lastName,
    String? fullName,
    String? mobile,
    String? nationalId,
    String? breedingUniqueId,
  }) = _PoultryTenant;

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

@freezed
abstract class Hatching with _$Hatching {
  const factory Hatching({
    String? poultryKey,
    String? poultryHatchingKey,
    String? poultry,
    int? quantity,
    int? losses,
    int? leftOver,
    double? outProvinceKilledQuantity,
    double? exportKilledQuantity,
    int? hall,
    String? date,
    int? period,
    String? state,
    int? age,
  }) = _Hatching;

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

@freezed
abstract class Allow with _$Allow {
  const factory Allow({
    bool? city,
    bool? province,
  }) = _Allow;

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

@freezed
abstract class ProvinceAllowChooseKillHouse with _$ProvinceAllowChooseKillHouse {
  const factory ProvinceAllowChooseKillHouse({
    bool? allowState,
    bool? mandatory,
  }) = _ProvinceAllowChooseKillHouse;

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

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

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

@freezed
abstract class LastHatchingDiffrentRequestQuantity
    with _$LastHatchingDiffrentRequestQuantity {
  const factory LastHatchingDiffrentRequestQuantity({
    dynamic leftExportQuantity,
    double? leftPoultryOutProvince,
    int? lastHatchingRemainQuantity,
  }) = _LastHatchingDiffrentRequestQuantity;

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

@freezed
abstract class UserBankInfo with _$UserBankInfo {
  const factory UserBankInfo({
    String? key,
    String? nameOfBankUser,
    String? bankName,
    String? card,
    String? shaba,
    String? account,
    int? userBankIdKey,
    String? provinceName,
  }) = _UserBankInfo;

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

@freezed
abstract class ChainCompany with _$ChainCompany {
  const factory ChainCompany({
    ChainUser? user,
    dynamic userBankInfo,
    String? key,
    bool? trash,
    String? name,
    dynamic city,
    dynamic province,
    dynamic postalCode,
    dynamic address,
    int? wallet,
  }) = _ChainCompany;

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

@freezed
abstract class ChainUser with _$ChainUser {
  const factory ChainUser({
    List<String>? role,
    String? city,
    String? province,
    String? key,
    String? userGateWayId,
    dynamic userDjangoIdForeignKey,
    dynamic provinceIdForeignKey,
    dynamic cityIdForeignKey,
    dynamic systemUserProfileIdKey,
    String? fullname,
    String? firstName,
    String? lastName,
    dynamic nationalCode,
    dynamic nationalCodeImage,
    String? nationalId,
    String? mobile,
    dynamic birthday,
    dynamic image,
    String? password,
    bool? active,
    ChainUserState? state,
    int? baseOrder,
    int? cityNumber,
    String? cityName,
    int? provinceNumber,
    String? provinceName,
    String? unitName,
    String? unitNationalId,
    String? unitRegistrationNumber,
    String? unitEconomicalNumber,
    String? unitProvince,
    String? unitCity,
    String? unitPostalCode,
    String? unitAddress,
  }) = _ChainUser;

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

@freezed
abstract class ChainUserState with _$ChainUserState {
  const factory ChainUserState({
    String? city,
    String? image,
    String? mobile,
    String? birthday,
    String? province,
    String? lastName,
    String? firstName,
    String? nationalId,
    String? nationalCode,
  }) = _ChainUserState;

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

@freezed
abstract class ActiveKill with _$ActiveKill {
  const factory ActiveKill({
    bool? activeKill,
    int? countOfRequest,
  }) = _ActiveKill;

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

@freezed
abstract class KillingInfo with _$KillingInfo {
  const factory KillingInfo({
    String? violationMessage,
    int? provinceKillRequests,
    int? provinceKillRequestsQuantity,
    double? provinceKillRequestsWeight,
    int? killHouseRequests,
    int? killHouseRequestsFirstQuantity,
    double? killHouseRequestsFirstWeight,
    int? barCompleteWithKillHouse,
    int? acceptedRealQuantityFinal,
    double? acceptedRealWightFinal,
    int? wareHouseBars,
    int? wareHouseBarsQuantity,
    double? wareHouseBarsWeight,
    double? wareHouseBarsWeightLose,
  }) = _KillingInfo;

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

@freezed
abstract class FreeGovernmentalInfo with _$FreeGovernmentalInfo {
  const factory FreeGovernmentalInfo({
    int? governmentalAllocatedQuantity,
    double? totalCommitmentQuantity,
    int? freeAllocatedQuantity,
    double? totalFreeCommitmentQuantity,
    int? leftTotalFreeCommitmentQuantity,
  }) = _FreeGovernmentalInfo;

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

@freezed
abstract class ManagementHatchingAgeRange with _$ManagementHatchingAgeRange {
  const factory ManagementHatchingAgeRange({
    double? fromWeight,
    double? toWeight,
  }) = _ManagementHatchingAgeRange;

  factory ManagementHatchingAgeRange.fromJson(Map<String, dynamic> json) =>
      _$ManagementHatchingAgeRangeFromJson(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 Breed with _$Breed {
  const factory Breed({
    String? breed,
    int? mainQuantity,
    int? remainQuantity,
  }) = _Breed;

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

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

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

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

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