Rails.application.routes.draw do

  root to: 'web/home#index'

  ActiveAdmin.routes(self)

  devise_for :candidates, controllers: {registrations: 'web/candidates/registrations'}
  devise_for :companies
  devise_for :admin_users, ActiveAdmin::Devise.config

  namespace :api, defaults: {format: :json} do
    namespace 'v1', path: '1' do

      resource :candidate, only: [:show, :update]
      resources :hard_skills, only: [:index]

      resource :company, only: [:show, :update]
      resources :offers, except: [:new, :edit, :destroy]
    end
  end

  scope module: :web do

    get 'about' => 'pages#about'

    resource :login, only: [:create]

    resource :candidate, only: [] do
      resources :saved_offers,     only: [:index]
      resources :contacted_offers, only: [:index]
    end

    resources :candidates, only: [:index, :show]
    resources :offers,     only: [:index, :show, :new, :create] do
      resources :offer_soft_skill_values, only: [:new, :create]

      resources :saved_offers,     only: [:create]
      resources :contacted_offers, only: [:create]
    end

  end

end
