from appservices.common.util import *

wallet_debit_requests = Blueprint("wallet_debit_requests",__name__)

# Get settlement requests
@wallet_debit_requests.route('/get_debit_requests', methods=['GET'])
@adminid_access_token_required
def get_debit_requests():
    if not session.get("adminId"):
        return redirect("admin_login")
    return render_template("super_admin_templates/debit_requests_list.html")



@wallet_debit_requests.route('/data_migration', methods=['GET',"POST"])
@adminid_access_token_required
def data_migration():
    # with open('data.csv', 'r') as file:
    #     # Create a CSV reader object
    #     csv_reader = csv.reader(file)

    #     for row in csv_reader:
    #         # Assuming the CSV file has multiple columns, you can access values by index
    #         # Here, we're extracting the second and fourth values from each row
    #         value1 = row[1]
    #         value2 = row[2]

    #         print(value1)
    #         print(value2)
    #         print("(((((((((((((((((data_migration)))))))))))))))))")





    with open('/home/ubuntu/appservices/appservices/pincode.csv', "r") as csvfile:
    # Create a CSV reader object
        csv_reader = csv.reader(csvfile)
        
        # Skip the header row if it contains column names
        next(csv_reader)
    
    # Iterate over each row in the CSV file
        for row in csv_reader:
            # Unpack each column value
            circleName = row[0]
            RegionName = row[1]
            divisionName = row[2]
            officeName = row[3]
            pincode = row[4]
            
            # Do whatever you want with the unpacked values, e.g., print them
            print(f"circleName: {circleName}")
            print(f"RegionName: {RegionName}")
            print(f"divisionName: {divisionName}")
            print(f"officeName: {officeName}")
            print(f"Pincode: {pincode}")

