using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace MYRIDE
{
    internal class Driver
    {
        string name;
        int age;
        string gender;
        string address;
        string phoneNo;
        //List<int> rating; 
        int ratingCount;
        float avgStars; //It will Cumulative Rating
        Location currentLocation;
        Vehicle vehicle;
        bool availability;
        int id;

        //I have studied about GUIDs for this purpose
        /// <summary>
        /// A GUID is an acronym of Globally Unique Identifier 
        /// It is a 128-bits integer (16 Bytes)
        /// It can be used across servers, networks, databases and computers, Bcz it has low probabilty of being duplicated
        /// It's generated by combination of MAC + Timestamp + Extra + ID for Algo
        /// Extra(emergency uniquifier bits) -> to ensure that GUIDs generated at nearly exactly the same time on the same machine are unique
        /// ID for the algo -> so that GUIDs generated with a different algorithm are unique
        /// It has 5 multiple type of return formats -> D, N, B, P, X
        /// return Formats looks like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
        /// Example: 6B29FC40-CA47-1067-B31D-00DD010662DA
        /// </summary>

        public Driver()
        {
            name = string.Empty;
            age = 0;
            gender = string.Empty;
            address = string.Empty;
            phoneNo = string.Empty;
            ratingCount = 0;
            avgStars = 0;
            vehicle = new Vehicle();
            availability = false;
            currentLocation = new Location();
            id = 100;
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        public int Age
        {
            get { return age; }
            set { age = value; }
        }
        public string Gender
        {
            get { return gender; }
            set { gender = value; }
        }
        public string Address
        {
            get { return address; }
            set { address = value; }
        }
        public string PhoneNo
        {
            get { return phoneNo; }
            set { phoneNo = value; }
        }
        public Location CurrentLocation
        {
            get { return currentLocation; }
            set { currentLocation = value; }
        }
        public Vehicle Vehicle
        {
            get { return vehicle; }
            set { vehicle = value; }

        }
        public float AvgStars
        {
            get { return avgStars; }
            set { avgStars = value; }  
        }
        public int RatingCount
        {
            get { return ratingCount; }
            set { ratingCount = value; }
        }
        public bool Availability
        {
            get { return availability; }
            set { availability = value; }
        }

        public bool getAvailability() { return availability; }
        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        public void updateAvailability(bool val)
        {
            this.availability = val;
        }
        
        public void calculateRating()
        {
            avgStars = avgStars / ratingCount;
        }
        public void updateLocation(Location loc)
        {
            currentLocation = loc;
        }
        public void updateLocation(string loc)
        {
            currentLocation.setLocation(loc);
        }
    }
}
