function init (
    address _ownerAddress,
    address _borrowerAddress,
    address _lenderAddress,
    address _collateralTokenAddress,
    uint _borrowAmount,
    uint _paybackAmount,
    uint _collateralAmount,
    uint _daysPerInstallment,
    uint _remainingInstallment,
    string _loanId
  ) public onlyFactoryContract {
    require(_collateralTokenAddress != address(0), "Invalid token address");
    require(_borrowerAddress != address(0), "Invalid lender address");
    require(_lenderAddress != address(0), "Invalid lender address");
    require(_remainingInstallment > 0, "Invalid number of installments");
    require(_borrowAmount > 0, "Borrow amount must not be 0");
    require(_paybackAmount > 0, "Payback amount must not be 0");
    require(_collateralAmount > 0, "Collateral amount must not be 0");
    super._mint(_lenderAddress, 1);
    factoryContract = msg.sender;
    ownerAddress = _ownerAddress;
    loanId = _loanId;
    collateralTokenAddress = _collateralTokenAddress;
    borrowAmount = _borrowAmount;
    collateralAmount = _collateralAmount;
    totalLoanTerm = _remainingInstallment * _daysPerInstallment;
    daysPerInstallment = _daysPerInstallment;
    remainingInstallment = _remainingInstallment;
    installmentAmount = _paybackAmount / _remainingInstallment;
    token = StandardToken(_collateralTokenAddress);
    borrowerAddress = _borrowerAddress;
    lenderAddress = _lenderAddress;

    
    currentState = States.WaitingForCollateral;
  }