package com.oguerreiro.resilient.web.rest;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.oguerreiro.resilient.domain.Dashboard;
import com.oguerreiro.resilient.repository.DashboardRepository;
import com.oguerreiro.resilient.service.DashboardService;
import com.oguerreiro.resilient.service.dto.DashboardDTO;

/**
 * REST controller for managing {@link com.oguerreiro.resilient.domain.Dashboard}.
 */
@RestController
@RequestMapping("/api/dashboards")
public class DashboardResource extends AbstractResilientResource<Dashboard, DashboardDTO, Long> {

  private static final String ENTITY_NAME = "dashboard";
  private final DashboardService dashboardService;

  public DashboardResource(DashboardRepository dashboardRepository, DashboardService dashboardService) {
    super(Dashboard.class, dashboardRepository, dashboardService);
    this.dashboardService = dashboardService;
  }

  /* Abstract methods impl*/
  @Override
  protected String getEntityName() {
    return ENTITY_NAME;
  }

  /* DashboardResource endpoints */
  @GetMapping("/internal")
  public List<DashboardDTO> getAllInternal() {
    log.debug("REST request to get all Dashboard's.");
    return this.dashboardService.findAllInternal();
  }
}
