def migrate_expert_annotation(origin_annotation: ExpertAnnotation, mapping: Mapping) -> list[AbstractAnnotation]:
expert_annotation = deepcopy(origin_annotation)
authors = expert_annotation.authors
authors.append(migration_author)
expert_annotation.authors = authors
annotated_apiv1_element = get_annotated_api_element(expert_annotation, mapping.get_apiv1_elements())
if annotated_apiv1_element is None:
return []
expert_annotations: list[AbstractAnnotation] = []
for element in mapping.get_apiv2_elements():
if isinstance(element, type(annotated_apiv1_element)) and not isinstance(element, Attribute | Result):
expert_annotations.append(
ExpertAnnotation(
element.id,
authors,
expert_annotation.reviewers,
expert_annotation.comment,
EnumReviewResult.NONE,
),
)
elif not isinstance(element, Attribute | Result):
expert_annotations.append(
TodoAnnotation(
element.id,
authors,
expert_annotation.reviewers,
expert_annotation.comment,
EnumReviewResult.NONE,
get_migration_text(expert_annotation, mapping, for_todo_annotation=True),
),
)
return expert_annotations