module Devops
  module API3
    module Routes
      module StatisticRoutes

        def self.registered(app)
          app.define_policy :read_statistic, "Read statistic"

          app.get_with_headers '/statistic' do
            check_policy(:read_statistic)
            json Devops::API3::Handler::Statistic.new(request).statistic().map(&:to_hash)
          end

          puts "Statistic routes initialized"
        end

      end
    end
  end
end
