class Admin::Accounting::Invoices::ConfigsController < Admin::Accounting::Controller
  def update
    if config.update(config_params)
      render_success :ok
    else
      render_error :unprocessable_entity, errors: config
    end
  end

  private
    def config
      @config ||= current_school.find_or_build_accounting_invoice_config
    end

    def config_params
      params.permit(:enabled, :include_allocations)
    end

    def config_props
      {
        enabled: config.enabled,
        include_allocations: config.include_allocations
      }
    end
end
