import {
  FETCH_COMPANIES_REQUEST,
  FETCH_COMPANIES_SUCCESS,
  FETCH_COMPANIES_FAILURE,
  FETCH_COMPANY_REQUEST,
  FETCH_COMPANY_SUCCESS,
  FETCH_COMPANY_FAILURE,
  FETCH_EMPHASIS_COMPANIES_REQUEST,
  FETCH_EMPHASIS_COMPANIES_SUCCESS,
  FETCH_EMPHASIS_COMPANIES_FAILURE,
  CLEAR_COMPANY,
  COUNT_COMPANY_VIEW,
} from '../types'


//COMPANIES list

export const fetchCompaniesRequest = (payload) => ({
  type: FETCH_COMPANIES_REQUEST,
  payload
});

export const fetchCompaniesSuccess = res => ({
  type: FETCH_COMPANIES_SUCCESS,
  res
});

export const fetchCompaniesFailure = res => ({
  type: FETCH_COMPANIES_FAILURE,
  res
});

//COMPANY single
export const countCompanyViewRequest = (id) => ({
  type: COUNT_COMPANY_VIEW,
  id
});

export const fetchCompanyRequest = payload => ({
  type: FETCH_COMPANY_REQUEST,
  payload
});

export const fetchCompanySuccess = res => ({
  type: FETCH_COMPANY_SUCCESS,
  res
});

export const fetchCompanyFailure = res => ({
  type: FETCH_COMPANY_FAILURE,
  res
});

//EMPHASIS 'aka mise en avant'

export const fetchEmphasisCompaniesRequest = (payload) => ({
  type: FETCH_EMPHASIS_COMPANIES_REQUEST,
  payload
});

export const fetchEmphasisCompaniesSuccess = res => ({
  type: FETCH_EMPHASIS_COMPANIES_SUCCESS,
  res
});

export const fetchEmphasisCompaniesFailure = res => ({
  type: FETCH_EMPHASIS_COMPANIES_FAILURE,
  res
});

  //clear ad
  export const clearCompany = res => ({
    type: CLEAR_COMPANY
  });