/**
 * An element which displays sidebar information for a tag. Primarily used in the repo view.
 */
angular.module('quay').directive('tagInfoSidebar', function () {
  var directiveDefinitionObject = {
    priority: 0,
    templateUrl: '/static/directives/tag-info-sidebar.html',
    replace: false,
    transclude: true,
    restrict: 'C',
    scope: {
      'tracker': '=tracker',
      'tag': '=tag',

      'imageSelected': '&imageSelected',
      'deleteTagRequested': '&deleteTagRequested'
    },
    controller: function($scope, $element) {
      $scope.$watch('tag', function(tag) {
        if (!tag || !$scope.tracker) { return; }

        $scope.tagImage = $scope.tracker.getImageForTag(tag);
        $scope.tagData = $scope.tracker.lookupTag(tag);
      });
    }
  };
  return directiveDefinitionObject;
});