"""
This script will create an input csv for the recommendation engine and upload it to S3, which can be used for
testing
"""
import pandas as pd
from utils.s3 import save_csv_to_s3

USER_ID = 8
PORTFOLIO_ID = 62


def app():
    """
    This portfolio contains propertyies that we have demo'd in pilots, or properties that were provided to us
    as proprties that are being treated under funding scehemes and we have pre/post EPRs for
    :return:
    """

    test_file = pd.DataFrame(
        [
            # Live West Properties
            {"address": "42, Foxes Field", "postcode": "TR18 3RJ", "Notes": None},
            {"address": "11, Cranley Gardens", "postcode": "TQ13 8UT", "Notes": None},
            # Keyzy properties
            {'address': '2 South Terrace', 'postcode': 'NN1 5JY', 'Notes': ''},
            {'address': '25 Albert Street', 'postcode': 'PO12 4TY', 'Notes': ''},
            # Pilot properties
            {'address': '113 Tenby Road', 'postcode': 'B13 9LT', 'Notes': ''},
            {'address': '139 School Road', 'postcode': 'B28 8JF', 'Notes': ''},
            {'address': '77 Simmons Drive', 'postcode': 'B32 1SL', 'Notes': ''},
            {'address': 'Flat 2, 54 Wedgewood Road', 'postcode': 'B32 1LS', 'Notes': ''},
            # Warmfront ECO4 Properties
            {'address': '73 Long Chaulden', 'postcode': 'HP1 2HX', 'Notes': ''},
            {'address': '8 Lindlings', 'postcode': 'HP1 2HA', 'Notes': ''},
            {'address': '44 Lindlings', 'postcode': 'HP1 2HE', 'Notes': ''},
            {'address': '46 Chaulden Terrace', 'postcode': 'HP1 2AN', 'Notes': ''},
            # Osmosis SHDF Properties
            {'address': '4, Heather Shaw', 'postcode': 'BA14 7JS', 'Notes': ''},
            {'address': '16 Glastonbury Road', 'postcode': 'M32 9PE', 'Notes': ''},
            {'address': '31 Loddon Way', 'postcode': 'BA15 1HG', 'Notes': ''},
            {'address': '62 Pearmain Drive', 'postcode': 'NG3 3DJ', 'Notes': ''},
        ]

    )

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

    body = {
        "portfolio_id": str(PORTFOLIO_ID),
        "housing_type": "Social",
        "goal": "Increase EPC",
        "goal_value": "A",
        "trigger_file_path": filename
    }
    print(body)
