/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Inject, Injectable } from '@angular/core';
import { LocationMapService } from './map/location-map.service';
import { LsLocation } from './model';

@Injectable()
export class LocationEditingBehavior {
  constructor(@Inject(LocationMapService) private locationMapService: LocationMapService) {}

  canSetBoundary(location: LsLocation): boolean {
    return !!location && !this.locationMapService.hasBoundary(location);
  }

  canRemoveBoundary(location: LsLocation) {
    return !!location && this.locationMapService.hasBoundary(location);
  }

  canSetPosition(location: LsLocation) {
    return !!location;
  }

  canRemovePosition(location: LsLocation) {
    return !!location && this.locationMapService.hasPosition(location);
  }
}
