/*
 * This file is part of OsmInEdit, released under ISC license (see LICENSE.md)
 *
 * Copyright (c) Adrien Pavie 2019
 * Copyright (c) Daimler AG 2019
 *
 * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

import React, { Component } from 'react';
import Body from '../Body';
import Button from 'react-bootstrap/Button';
import I18n from '../../config/locales/ui';
import Modal from 'react-bootstrap/Modal';

/**
 * OutOfBoundsGeometry dialog alerts the user that the geometry he edited is outside the limits of building/level.
 */
class OutOfBoundsGeometryDialog extends Component {
	render() {
		return <Modal show={this.props.show} onHide={this.props.onClose} size="lg">
			<Modal.Header closeButton>
				<Modal.Title>{I18n.t("Geometry outside of the bounds")}</Modal.Title>
			</Modal.Header>
			<Modal.Body>
				{this.props.mode === Body.MODE_LEVELS && I18n.t("The level contour you just edited is partially or completely outside of the building contour. Please make sure that the level contour is mostly contained in the building.")}
				{this.props.mode === Body.MODE_FEATURES && I18n.t("The feature contour you just edited is partially or completely outside of the level contour. Please make sure that the feature contour is mostly contained in the floor.")}
			</Modal.Body>
			<Modal.Footer>
				<Button variant="secondary" onClick={this.props.onClose}>
					{I18n.t("OK")}
				</Button>
			</Modal.Footer>
		</Modal>;
	}
}

export default OutOfBoundsGeometryDialog;
