insert  into drivers (id, pin, name) values (7357, 7357, 'Test driver');

insert  into groups
  (group_id, group_name)
  values
  (73576, 'TEST-ORG'),
  (73577, 'TEST-SCHOOL'),
  (73578, 'TEST-GOV'),
  (73579, 'TEST-OTHER-ORG')
;

insert  into org_default_card_value
  (group_id, mag_track, rf_length, rf_site)
  values
  (73576, 2, 26, 137),
  (73577, 2, 26, 250),
  (73578, 2, 35, 507),
  (73579, 3, 26, 137)
;

insert  into rule_class
  (rulename, ruleclass)
  values
  ('TEST-ORG-NRIDE', 'NRIDE'),
  ('TEST-ORG-NDAY', 'NDAY'),
  ('TEST-ORG-TESTING', 'OTHER'),
  ('TEST-ORG-REJECT', 'OTHER'),
  ('TEST-SCHOOL-PASS', 'OTHER'),
  ('TEST-GOV-PASS', 'OTHER'),
  ('TEST-OTHER-ORG-PASS', 'OTHER')
;

insert  into rule_mappings
  (rule, rule_text, group_id, active)
  values
  ('TEST-ORG-NRIDE', 'N-Ride Test Pass', 73576, 1),
  ('TEST-ORG-NDAY', 'N-Day Test Pass', 73576, 1),
  ('TEST-ORG-TESTING', 'Org Test Pass', 73576, 1),
  ('TEST-ORG-REJECT', 'No passes on Card', NULL, 1),

  ('TEST-SCHOOL-PASS', 'School Test Pass', 73577, 1),
  ('TEST-GOV-PASS', 'Gov. Test Pass', 73578, 1),
  ('TEST-OTHER-ORG-PASS', 'Other Org. Test Pass', 73579, 1)
;


insert  into user_card
  (logical_card_id, mag_token, rfid_token, comment,
   issued, active,
   deactivated, lastused, firstused,
   group_id, issuetype)
  values

  (1, '2:7370000000007015', '26:137:677', 'testing card 0',
    now(), 1,
   NULL, NULL, NULL,
   73576, NULL),

  (2, '2:65465412301', '26:250:8002', 'testing card 1',
    now(), 1,
   NULL, NULL, NULL,
   73577, NULL),

  (3, '2:255100010170331', '35:507:100569', 'testing card 2',
    now(), 1,
   NULL, NULL, NULL,
   73578, NULL),

  (4, '3:7100306127', NULL, 'testing card 3',
    now(), 1,
   NULL, NULL, NULL,
   73579, NULL)
;

insert  into user_pass
  (user_pass_id, logical_card_id,
   issued, activated, deactivated,
   firstused, lastused,
   nrides_orig, nrides_remain,
   nday_orig, nday_expiration,
   active, expired,
   rule, queue_order,
   comment, paytype)

  values

  -- card 1 passes (nride then nday)
  (11, 1,
   now(), now(), NULL,
   NULL, NULL,
   5, 5,
   NULL, NULL,
   1, 0,
   'TEST-ORG-NRIDE', 1, 'Test pass', NULL),
  (12, 1,
   now(), now(), NULL,
   NULL, NULL,
   NULL, NULL,
   15, NULL,
   0, 0,
   'TEST-ORG-NDAY', 2, 'Test pass', NULL),

  -- card 2 passes
  (13, 2,
   now(), now(), NULL,
   NULL, NULL,
   NULL, NULL,
   NULL, NULL,
   1, 0,
   'TEST-SCHOOL-PASS', 1, 'Test pass', NULL),

  -- card 3 passes
  (14, 3,
   now(), now(), NULL,
   NULL, NULL,
   NULL, NULL,
   NULL, NULL,
   1, 0,
   'TEST-GOV-PASS', 1, 'Test pass', NULL),

  -- card 4 passes
  (15, 4,
   now(), now(), NULL,
   NULL, NULL,
   NULL, NULL,
   NULL, NULL,
   1, 0,
   'TEST-OTHER-ORG-PASS', 1, 'Test pass', NULL)
;


insert into active_rider_table
  (logical_card_id, mag_token, rfid_token, rule_name, rule_param, deleted)
  values
  (1, '2:7370000000007015', '26:137:677', 'TEST-ORG-NRIDE', 5, 0),
  (2, '2:65465412301', '26:250:8002', 'TEST-SCHOOL-PASS', NULL, 0),
  (3, '2:255100010170331', '35:507:100569', 'TEST-GOV-PASS', NULL, 0),
  (4, '3:7100306127', NULL, 'TEST-OTHER-ORG-PASS', NULL, 0);

