import {
  FETCH_JOBS_REQUEST,
  FETCH_JOBS_SUCCESS,
  FETCH_JOBS_FAILURE,
  FETCH_JOB_REQUEST,
  FETCH_JOB_SUCCESS,
  FETCH_JOB_FAILURE,
  FETCH_EMPHASIS_JOBS_REQUEST,
  FETCH_EMPHASIS_JOBS_SUCCESS,
  FETCH_EMPHASIS_JOBS_FAILURE,
  CLEAR_AD,
  COUNT_AD_VIEW,
  TOGGLE_PROMOTED_FILTER_ADS
} from '../types'

//Ads stat count

export const countAdViewRequest = (id) => ({
  type: COUNT_AD_VIEW,
  id
});

//Is ads promoted?

export const togglePromotedFilterRequest = () => ({
  type: TOGGLE_PROMOTED_FILTER_ADS
});

//Ads list

export const fetchJobsRequest = (payload) => ({
    type: FETCH_JOBS_REQUEST,
    payload
  });
  
  export const fetchJobsSuccess = res => ({
    type: FETCH_JOBS_SUCCESS,
    res
  });
  
  export const fetchJobsFailure = res => ({
    type: FETCH_JOBS_FAILURE,
    res
  });

  //Ads list
  
  export const fetchEmphasisJobsRequest = (payload) => ({
      type: FETCH_EMPHASIS_JOBS_REQUEST,
      payload
    });
    
    export const fetchEmphasisJobsSuccess = res => ({
      type: FETCH_EMPHASIS_JOBS_SUCCESS,
      res
    });
    
    export const fetchEmphasisJobsFailure = res => ({
      type: FETCH_EMPHASIS_JOBS_FAILURE,
      res
    });

  //Single ad

  export const fetchJobRequest = payload => ({
    type: FETCH_JOB_REQUEST,
    payload
  });
  
  export const fetchJobSuccess = res => ({
    type: FETCH_JOB_SUCCESS,
    res
  });
  
  export const fetchJobFailure = res => ({
    type: FETCH_JOB_FAILURE,
    res
  });

  //clear ad
  export const clearAd = res => ({
    type: CLEAR_AD
  });