class Employee::Legacy::AccountsController < Employee::Controller
  def show
    render_success :ok, json: props
  end

  private
    def email_addresses
      @email_addresses ||= current_employee.email_addresses.index_by(&:primary)
    end

    def props
      {
        name: current_employee.full_name,
        address: current_employee.address,
        address_ext: current_employee.address_ext,
        city: current_employee.city,
        state: current_employee.state,
        zip: current_employee.zip,
        home_address: current_employee.home_address,
        home_address_ext: current_employee.home_address_ext,
        home_city: current_employee.home_city,
        home_state: current_employee.home_state,
        home_zip: current_employee.home_zip,
        home_phone: current_employee.decorate.home_phone_number,
        cell_phone: current_employee.decorate.mobile_phone_number,
        work_phone: current_employee.decorate.work_phone_number,
        work_phone_2: current_employee.decorate.other_phone_number,
        email: current_employee.email,
        email_verified: current_employee.email_verified?,
        email_3: current_employee.email_3,
        primary_email: email_addresses[true],
        secondary_email: email_addresses[false]
      }
    end
end
