<?php

namespace Drupal\batch\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\batch\Batch\ImportSwapi;

class BatchForm extends FormBase {
  public function getFormId() {
    return 'batch_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['date'] = array(
      '#type' => 'datetime',
      '#title' => 'Date and time',
    );

    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => 'Import',
      '#button_type' => 'primary',
    );
    return $form;
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $batch = new ImportSwapi();
    $batch->getOperations();
    $batch->setBatch();
  }
}
