def migrate_move_annotation(origin_annotation: MoveAnnotation, mapping: Mapping) -> list[AbstractAnnotation]:
annotated_apiv1_element = get_annotated_api_element(origin_annotation, mapping.get_apiv1_elements())
if annotated_apiv1_element is None:
return []
migrated_annotations: list[AbstractAnnotation] = []
for element in mapping.get_apiv2_elements():
move_annotation = deepcopy(origin_annotation)
authors = move_annotation.authors
authors.append(migration_author)
move_annotation.authors = authors
if (
isinstance(element, type(annotated_apiv1_element))
and is_moveable(element)
and not isinstance(element, Attribute | Result)
):
review_result = (
EnumReviewResult.UNSURE
if _was_moved(
get_annotated_api_element(move_annotation, mapping.get_apiv1_elements()),
element,
move_annotation,
)
else EnumReviewResult.NONE
)
move_annotation.target = element.id
move_annotation.reviewResult = review_result
migrated_annotations.append(move_annotation)
elif not isinstance(element, Attribute | Result):
migrated_annotations.append(
TodoAnnotation(
element.id,
authors,
move_annotation.reviewers,
move_annotation.comment,
EnumReviewResult.NONE,
get_migration_text(move_annotation, mapping, for_todo_annotation=True),
),
)
return migrated_annotations