import csv, os

class car_space:

    def __init__(self, client_id, enable, distance):
        self.client_id = client_id
        self.enable = enable
        self.distance = distance

    def __repr__(self):
        return "ID: {0}, car: {1}, distance: {2}".format(self.client_id, self.enable, self.distance)

    def set_enable(self, enabled):
        if type(enabled) == bool:
            self.enable = enabled
            return self.enable
        pass

    def set_distance(self, distance):
        if type(distance) == int:
            self.distance = distance
            return self.distance
        pass

    @staticmethod
    def get_account():
        dir = os.path.dirname(__file__)
        account_path = os.path.join(dir, 'account.csv')
        account_csv = open(account_path, 'r')

        client_list = []
        with account_csv as f:
            reader = csv.reader(f, delimiter = ',')
            header = next(reader)
            for i in reader:
                client_list.append(car_space(i[0], False, 0))

        return client_list

if __name__ == "__main__":

    account = car_space.get_account()
    print(account)