/**
 * The component for comparing two json structures
 *
 * @author: Platon Fedorov
 * @date: 2021-12-27
 */
import React from 'react';
import ReactDiffViewer, {DiffMethod as JsonDifferenceCompareMethod} from 'react-diff-viewer';
import * as styles from './jsonDifference.m.scss';

interface IProps {
    oldValue: string | undefined;
    newValue: string | undefined;
    splitView?: boolean;
    disableWordDiff?: boolean;
    hideLineNumbers?: boolean;
    showDiffOnly?: boolean;
    useDarkTheme?: boolean;
    leftTitle?: string;
    rightTitle?: string;
    linesOffset?: number;
    codeFoldMessageRenderer?: (totalFoldedLines: number, leftStartLineNumber: number, rightStartLineNumber: number) => JSX.Element;
    compareMethod?: JsonDifferenceCompareMethod;
}

export {JsonDifferenceCompareMethod};

export class JsonDifference extends React.Component<IProps> {
    override render () {
        return (
            <div className={styles.container}>
                <ReactDiffViewer
                    {...this.props}
                />
            </div>
        );
    }
}
