package com.example.infiniteLoop.parkingo;

import android.util.Log;
import static java.lang.StrictMath.max;
/*! \class A Userinfo class
    A class having user details  and methods to set and get the user details
*/
public class userInfo {
    public static userInfo u_instance=null;
    private String username=null;
    private String u_name=null;
  /** @brief Return the userInfo Object
    @return userInfo
    */
    public static userInfo getInstance() {
        if(u_instance==null){
            u_instance=new userInfo();

        }
        Log.d("ins","called");
        return u_instance;
    }
    private int balance= 0;

  /** @brief get the u_name of userInfo
    @return String
    */
    public String getName() {
        return u_name;
    }
  /** @brief set the u_name of userInfo
    @return void
    */
    public void setU_name(String u_name) {
        this.u_name = u_name;
    }
   /** @brief get the username of userInfo
    @return String
    */
    public String getUsername() {
        return username;
    }
    /** @brief set the username of userInfo
    @return void
    */
    public void setUsername(String username) {
        this.username = username;
    }

    public int getBalance(){return this.balance;}

    public void setBalance(int newBalance){this.balance = newBalance;}
    public void deductCharge(int charge) {this.balance = max(this.balance - charge,0);}
}
