Auto update post title and slug when post status is changed

I think I found the solution:

 add_filter('wp_insert_post_data','reset_post_date',99,2);

     function reset_post_date($data,$postarr) {

     //update post time on status change
     $data['post_date'] = $data['post_modified'];
     $data['post_date_gmt'] = $data['post_modified_gmt'];

     //also update title and add the current date to title
     $data['post_title'] = 'Your Default Title - '. current_time ( 'm-d-Y' );

     //also update the slug of the post for the URL
     $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'] ), $postarr['ID'], $data['post_status'], $data['post_type'], $data['post_parent'] );

     return $data;  
 }