from enum import IntEnum, Enum

CRM_PIPELINE_NAME = 'Operations - Social Housing'


class HubspotProcessStatus(IntEnum):
    def __new__(cls, value, label):
        obj = int.__new__(cls, value)
        obj._value_ = value
        obj.label = label
        return obj

    # the numerical values of this enum aren't important, but they define the order of operations

    # This is the first stage, where a survey is ready to go
    READY_TO_BE_SCHEDULED = 1, "READY TO BE SCHEDULED"
    # The property didn't get access and needs sign off
    SURVEYED_NO_ACCESS_NEEDS_SIGN_OFF = 2, "NO ACCESS - NEED SIGN OFF"
    # The survey has been completed. We don't have any update as to whether the property has been installed
    SURVEYED_COMPLETED_SIGNED_OFF = 3, "SURVEYED - AUTOMATED SIGNED OFF"
    # The property turned out to be ineligibile
    NOT_VIABLE = 4, "NOT VIABLE"
    # The property is with the installer. This will likely be the default for historic programmes
    SUBMITTED_TO_INSTALLER = 5, "SUBMITTED TO INSTALLER"
    # The property has been installed
    INSTALL_COMPLETE = 6, "INSTALL COMPLETE"
    # The install has complete and lodgement is complete
    LODGEMENT_COMPLETE = 7, "LODGEMENT COMPLETE"
    # The property has been cancelled
    INSTALLER_CANCELLED_FINALIZED = 8, "INSTALLER CANCELLED - FINALIZED"


class Installer(Enum):
    SCIS = "SCIS"
    JJ_CRUMP = "J & J CRUMP"
    SGEC = "SGEC"
    WARMFRONT = "WARM FRONT"

    @classmethod
    def is_valid_value(cls, value):
        """
        Check if the value is a valid installer.
        """
        return value in cls._value2member_map_


CRM_UPLOAD_COLUMNS = [
    'Name <LISTING hs_name>', 'Associations: Listing', 'Company Domain Name <COMPANY domain>',
    'Email <CONTACT email>', 'First Name <CONTACT firstname>', 'Last Name <CONTACT lastname>',
    'Phone <CONTACT phone>', 'Secondary Phone <CONTACT secondary_phone_number>',
    'Secondary Contact Full Name <CONTACT secondary_contact_full_name>',
    'Listing Owner Email <LISTING hubspot_owner_id>',
    'Full Address <LISTING full_address>', 'Address 1 <LISTING hs_address_1>',
    'Address 2 <LISTING hs_address_2>', 'Postcode <LISTING hs_zip>',
    'Property Type <LISTING property_type>', 'Property Sub Type <LISTING property_sub_type>',
    'Bedroom(s) <LISTING hs_bedrooms>', 'Domna Property ID <LISTING domna_property_id>',
    'National UPRN <LISTING national_uprn>', 'Owner Property ID <LISTING owner_property_id>',
    'Wall Construction <LISTING wall_construction>', 'Heating System <LISTING heating_system>',
    'Year Built <LISTING hs_year_built>', 'Boiler Make <LISTING boiler_make>',
    'Boiler Model <LISTING boiler_model>',
    'Non-Intrusives: Date Checked <LISTING non_intrusives__date_checked>',
    'Non-Intrusives: Wall Type <LISTING non_intrusives__wall_type>',
    'Non-intrusives: Insulation <LISTING non_intrusives__insulation>',
    'Non-intrusives: Insulation Material <LISTING non_intrusives__insulation_material>',
    'Non-Intrusives: CIGA Check Required <LISTING non_intrusives__ciga_check_required>',
    'Non-Intrusives: PV Access Issues <LISTING non_intrusives__access_issues>',
    'Non-Intrusives: Roof Orientation <LISTING non_intrusives__roof_orientation>',
    'Non-Intrusives: Surveyor Notes <LISTING non_intrusives__surveyor_notes>',
    'Non-Intrusives: Surveyor Name <LISTING non_intrusives__surveyor_name>',
    'CIGA: Date Requested <LISTING ciga__date_requested>',
    'CIGA: Cavity Guarantee Found <LISTING ciga__cavity_guarantee_found>',
    'Last EPC: Is Estimated <LISTING last_epc__is_estimated>',
    'Last EPC: EPC Rating <LISTING last_epc__epc_rating>',
    'Last EPC: SAP Rating <LISTING last_epc__sap_rating>',
    'Last EPC: Main Heating Description <LISTING last_epc__main_heating_description>',
    'Last EPC: Heating Controls <LISTING last_epc__heating_controls>',
    'Last EPC: Lodgement Date <LISTING last_epc__lodgement_date>',
    'Last EPC: Floor Area <LISTING last_epc__floor_area>', 'Last EPC: Wall <LISTING last_epc__wall>',
    'Last EPC: Roof <LISTING last_epc__roof>', 'Last EPC: Floor <LISTING last_epc__floor>',
    'Last EPC: Room Height <LISTING last_epc__room_height>',
    'Last EPC: Age Band <LISTING last_epc__age_band>', 'Deal Stage <DEAL dealstage>',
    'Pipeline <DEAL pipeline>', 'Expected Commencement Date <DEAL expected_commencement_date>',
    'Deal Name <DEAL dealname>', 'Project Code <DEAL project_code>', 'Postcode <DEAL postcode>',
    'Product ID <LINE_ITEM hs_product_id>', 'Name <LINE_ITEM name>', 'Unit price <LINE_ITEM price>',
    'Quantity <LINE_ITEM quantity>', 'Deal Owner', 'Amount <DEAL amount>', 'Installer <DEAL installer>'
]
