import 'package:farm_tpf/custom_model/LocationUnit.dart';
import 'package:get/state_manager.dart';

class CheckChangeAnotherDropdown extends GetxController {
  LocationUnit currentCountry = LocationUnit();
  LocationUnit currentProvince = LocationUnit();
  LocationUnit currentDistrict = LocationUnit();
  LocationUnit currentWard = LocationUnit();

  void initValue() {
    currentCountry = LocationUnit();
    currentProvince = LocationUnit();
    currentDistrict = LocationUnit();
    currentWard = LocationUnit();
  }

  void changeCountry(LocationUnit country) {
    currentCountry = country;
    currentProvince = LocationUnit();
    currentDistrict = LocationUnit();
    currentWard = LocationUnit();
    update();
  }

  void changeCountryByIdAndName(int id, String name) {
    currentCountry = LocationUnit()
      ..id = id
      ..name = name;
    currentProvince = LocationUnit();
    currentDistrict = LocationUnit();
    currentWard = LocationUnit();
    update();
  }

  void changeProvince(LocationUnit province) {
    currentProvince = province;
    currentDistrict = LocationUnit();
    currentWard = LocationUnit();
    update();
  }

  void changeProvinceByIdAndName(int id, String name) {
    currentProvince = LocationUnit()
      ..id = id
      ..name = name;
    currentDistrict = LocationUnit();
    currentWard = LocationUnit();
    update();
  }

  void changeDistrict(LocationUnit district) {
    currentDistrict = district;
    currentWard = LocationUnit();
    update();
  }

  void changeDistrictByIdAndName(int id, String name) {
    currentDistrict = LocationUnit()
      ..id = id
      ..name = name;
    currentWard = LocationUnit();
    update();
  }

  void changeWard(LocationUnit ward) {
    currentWard = ward;
    update();
  }

  void changeWardByIdAndName(int id, String name) {
    currentWard = LocationUnit()
      ..id = id
      ..name = name;
    update();
  }
}
