package com.oguerreiro.resilient.web.rest;

import java.util.List;

import org.springframework.http.ResponseEntity;
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.VariableScope;
import com.oguerreiro.resilient.repository.VariableScopeRepository;
import com.oguerreiro.resilient.service.VariableScopeService;
import com.oguerreiro.resilient.service.dto.VariableScopeDTO;

/**
 * REST controller for managing {@link com.oguerreiro.resilient.domain.VariableScope}.
 */
@RestController
@RequestMapping("/api/variable-scopes")
public class VariableScopeResource extends AbstractResilientResource<VariableScope, VariableScopeDTO, Long> {

  private static final String ENTITY_NAME = "variableScope";

  private final VariableScopeService variableScopeService;

  public VariableScopeResource(VariableScopeService variableScopeService,
      VariableScopeRepository variableScopeRepository) {
    super(VariableScope.class, variableScopeRepository, variableScopeService);

    this.variableScopeService = variableScopeService;
  }

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

  /* VariableScopeResource endpoints */
  /**
   * {@code GET  /variable-scope/forData} : get all the VariableScope's with VariableScope.hiddenForData==FALSE
   *
   * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of VariableScope's in body.
   */
  @GetMapping("/forData")
  public List<VariableScopeDTO> getAllForData() {
    log.debug("REST request to get all getAllForData Id : {}");
    return variableScopeService.findAllForData();
  }

  /**
   * {@code GET  /variable-scope/forFactor} : get all the VariableScope's with VariableScope.hiddenForFactor==FALSE
   *
   * @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of VariableScope's in body.
   */
  @GetMapping("/forFactor")
  public List<VariableScopeDTO> getAllForFactor() {
    log.debug("REST request to get all getAllForFactor Id : {}");
    return variableScopeService.findAllForFactor();
  }
}
