# frozen_string_literal: true

Rails.application.routes.draw do
  get '/:team_id/opponent/:opponent_id/show', to: 'opponent#show', as: :opponent
  get '/:team_id/opponent/list', to: 'opponent#list', as: :opponent_list
  get '/:team_id/opponent/:opponent_id/upload_logo', to: 'opponent#upload_logo_get', as: :opponent_upload_logo_get
  post '/:team_id/opponent/:opponent_id/upload_logo', to: 'opponent#upload_logo_post', as: :opponent_upload_logo_post
  get 'sessions/new'
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
  get 'auth/:provider/callback', to: 'sessions#create'
  get '/login', to: 'sessions#new', as: :login
  # Defines the root path route ("/")
  get '/:team_id/', to: 'team#show', constraints: { team_id: /\d+/ }, as: :team
  get '/team/dashboard', to: 'team#list', as: :team_list
  get '/:team_id/event/list', to: 'event#list', constraints: { team_id: /\d+/ }, as: :event_list
  get '/:team_id/event/:event_id', to: 'event#show', constraints: { team_id: /\d+/, event_id: /\d+/ }, as: :event
  get '/:team_id/event/:event_id/lineup', to: 'event#lineup', constraints: { team_id: /\d+/, event_id: /\d+/ },
                                          as: :event_lineup
  post '/:team_id/event/:event_id/lineup_submit', to: 'event#lineup_submit', as: "event_lineup_submit"
  post '/:team_id/event/:event_id/lineup_email', to: 'event#lineup_email', as: "event_lineup_email"
  get '/:team_id/event/:event_id/lineup_card', to: 'event#lineup_card',
                                               constraints: { team_id: /\d+/, event_id: /\d+/ }, as: :event_lineup_card
  get '/:team_id/event/:event_id/lineup_card_template', to: 'event#lineup_card_template',
   constraints: { team_id: /\d+/, event_id: /\d+/ }, as: :event_lineup_card_template

  root to: 'main#index'
end
