import pandas as pd
from utils.s3 import read_excel_from_s3
from utils.s3 import save_csv_to_s3

PORTFOLIO_ID = 77
USER_ID = 8

patches = [
    {
        "address": "79 Perryn Road",
        "postcode": "W3 7LT",
        "roof-description": "Pitched, no insulation (assumed)"
    }
]


def app():
    asset_list = [
        {
            'uprn': 12103117,
            "address": "79 Perryn Road",
            "postcode": "W3 7LT",
        },

    ]

    asset_list = pd.DataFrame(asset_list)

    # Store the asset list in s3
    filename = f"{USER_ID}/{PORTFOLIO_ID}/pilot.csv"
    save_csv_to_s3(
        dataframe=asset_list,
        bucket_name="retrofit-plan-inputs-dev",
        file_name=filename
    )

    # Store patches in s3
    patches_filename = f"{USER_ID}/{PORTFOLIO_ID}/patches.json"
    save_csv_to_s3(
        dataframe=pd.DataFrame(patches),
        bucket_name="retrofit-plan-inputs-dev",
        file_name=patches_filename
    )

    body = {
        "portfolio_id": str(PORTFOLIO_ID),
        "housing_type": "Private",
        "goal": "Increase EPC",
        "goal_value": "B",
        "trigger_file_path": filename,
        "already_installed_file_path": "",
        "patches_file_path": patches_filename,
        "non_invasive_recommendations_file_path": "",
        "budget": None,
    }
    print(body)
