import 'package:farm_tpf/custom_model/Supply.dart';
import 'package:get/get.dart';

class ChangeSupply extends GetxController {
  Supply? currentSupply;
  int? selectedSupplyId;
  String? selectedSupplyName;
  String? unit;
  bool? isValid;

  void initValue() {
    currentSupply = Supply();
    selectedSupplyName = "";
    selectedSupplyId = -1;
    unit = "";
    isValid = true;
    update();
  }

  void change(Supply supply) {
    currentSupply = supply;
    selectedSupplyId = supply.id;
    selectedSupplyName = supply.tbSuppliesName;
    unit = supply.unit;
    update();
  }

  void changeByIdAndName(int supplyId, String supplyName, {String? unitName}) {
    selectedSupplyId = supplyId;
    selectedSupplyName = supplyName;
    unit = unitName;
    update();
  }

  void changeValid(bool valid) {
    isValid = valid;
    update();
  }
}
