How do you implement data lifecycle management, including archiving and recovery strategies, for Jpmorgan Chase &?
Implement manage_data_lifecycle(records, current_day, archive_after, purge_after, recover_ids). Each record is a dictionary with id, last_accessed, and state, where state is active or archived. Return records in input order with the action retain, archive, recover, or purge. Purging takes precedence over recovery when a record reaches the purge threshold. Recovery applies only to archived records that are not yet eligible for purging.
def manage_data_lifecycle(records, current_day, archive_after, purge_after, recover_ids):