import { AnnotationWrapper } from '@models/file/annotation.wrapper';

export const sortTopLeftToBottomRight = (a1: AnnotationWrapper, a2: AnnotationWrapper): number => {
    if (a1.y > a2.y) {
        return -1;
    }
    if (a1.y < a2.y) {
        return 1;
    }
    return a1.x < a2.x ? -1 : 1;
};

export const sortBottomLeftToTopRight = (a1: AnnotationWrapper, a2: AnnotationWrapper): number => {
    if (a1.x < a2.x) {
        return -1;
    }
    if (a1.x > a2.x) {
        return 1;
    }
    return a1.y < a2.y ? -1 : 1;
};

export const sortBottomRightToTopLeft = (a1: AnnotationWrapper, a2: AnnotationWrapper): number => {
    if (a1.y < a2.y) {
        return -1;
    }
    if (a1.y > a2.y) {
        return 1;
    }
    return a1.x > a2.x ? -1 : 1;
};

export const sortTopRightToBottomLeft = (a1: AnnotationWrapper, a2: AnnotationWrapper): number => {
    if (a1.x > a2.x) {
        return -1;
    }
    if (a1.x < a2.x) {
        return 1;
    }
    return a1.y > a2.y ? -1 : 1;
};
