//
// BusUnit.m
// Project
//
// Created by 杨殷杭 on 17/3/12.
//
//

#import "BusUnit.h"
#if DEBUG
 #import "Lang.h"
 #import "SDK.h"
 #import "BeanUtils.h"
 #import "CocoaUtils.h"
 #import "DrawUtils.h"
 #import "RandomUtils.h"
 #import "AutoCompleteViewController.h"
 #import "CalendarViewController.h"
 #import "ComboBoxViewController.h"
 #import "DropDownViewController.h"
 #import "MapViewController.h"
 #import "TextViewController.h"
 #import "UIConstants.h"
 #import "UIToolkit.h"
 #import "CardIOPaymentViewControllerDelegateImpl.h"
 #import "PayPalPaymentDelegateImpl.h"
 #import <BlocksKit/BlocksKit.h>
 #import <BlocksKit/BlocksKit+UIKit.h>
 #import <CardIO.h>
 #import <libextobjc/EXTScope.h>
 #import <LoremIpsum/LoremIpsum.h>
 #import <PayPal-iOS-SDK/PayPalMobile.h>
 #import <PureLayout/PureLayout.h>
 #import "Utility.h"
 #import "SalesEntryRoom.h"
 #import "PerlWS.h"
 #import "UIViewController+Privilege.h"
 #import "BookGoodsResponseJsonMapper.h"
 #import "BookingSummaryResponseJsonMapper.h"
 #import "FinishRescheduleResponseJsonMapper.h"
 #import "GetReschedulePolicyResponseJsonMapper.h"
 #import "PurchaseRecordResponseJsonMapper.h"
 #import "TrackBusStatusResponseJsonMapper.h"
 #import "AddressListViewController.h"
 #import "CreditCardListViewController.h"
 #import "BusCheckInViewController.h"
 #import "BusStatusInfoResultViewController.h"
 #import "BusStatusEditViewController.h"
 #import "BookingCheckoutViewController.h"
 #import "BookingFinishViewController.h"
 #import "BookingReviewViewController.h"
 #import "BusHotelSearchBoxViewController.h"
 #import "BusRescheduleViewController.h"
 #import "BusVendorReviewListViewController.h"
 #import "BusVendorReviewDetailViewController.h"
 #import "CheckInResultViewController.h"
 #import "FlightInfoViewController.h"
 #import "LoginViewController.h"
 #import "HotelSearchListViewController.h"
 #import "PassportViewController.h"
 #import "PaymentInfoViewController.h"
 #import "ProductPickViewController.h"
 #import "PurchaseRecordViewController.h"
 #import "ReschedulePolicyViewController.h"
 #import "ScheduleDriverSearchViewController.h"
 #import "ScheduleDriverLocationViewController.h"
 #import "SchedulePassengerListViewController.h"
 #import "SecurityAttentionViewController.h"
 #import "SecurityVerificationViewController.h"
 #import "SelectLocationViewController.h"
 #import "SelfCheckInSearchViewController.h"
 #import "SoldStockBarcodeViewController.h"
 #import "SoldStockListViewController.h"
 #import "TrackBusStatusViewController.h"
 #import "VendorDatePickController.h"
 #import "AppUnitSubclass.h"
 #import "Vars.h"

@interface TableViewDataVC : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) NSArray *cellDataArrays;
@property (nonatomic, strong) NSArray *headerDataArray;
@end

@implementation TableViewDataVC

- (void)viewDidLoad {
	[super viewDidLoad];

	UITableView *tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
	tableView.dataSource = self;
	tableView.delegate = self;
	[self.view addSubview:tableView];

	NSMutableArray *arrays = [NSMutableArray array];
	if (YES) {
		NSMutableArray *array = [NSMutableArray array];
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentencesWithNumber:2];
			data.allowsTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.editingType = TableViewCellEditingTypeSegmentedControl;
			data.optionTexts = @[[LoremIpsum word], [LoremIpsum word], [LoremIpsum word]];
			[array addObject:data];
		}
		[arrays addObject:array];
	}
	if (YES) {
		NSMutableArray *array = [NSMutableArray array];
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentence];
			data.detailText = [LoremIpsum word];
			data.allowsTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentence];
			data.detailText = [LoremIpsum wordsWithNumber:2];
			data.allowsDetailTextWidthFitting = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeSegmentedControl;
			data.optionTexts = @[[LoremIpsum word], [LoremIpsum word]];
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentence];
			data.editingType = TableViewCellEditingTypeStepper;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue1;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentence];
			data.allowsTextLineWrapping = YES;
			data.editingType = TableViewCellEditingTypeSwitch;
			[array addObject:data];
		}
		[arrays addObject:array];
	}
	if (YES) {
		NSMutableArray *array = [NSMutableArray array];
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue2;
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum word];
			data.detailText = [LoremIpsum sentence];
			data.allowsDetailTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue2;
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue2;
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeSegmentedControl;
			data.optionTexts = @[[LoremIpsum word], [LoremIpsum word]];
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue2;
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeStepper;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleValue2;
			data.text = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeSwitch;
			[array addObject:data];
		}
		[arrays addObject:array];
	}
	if (YES) {
		NSMutableArray *array = [NSMutableArray array];
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentencesWithNumber:2];
			data.allowsTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentencesWithNumber:2];
			data.detailText = [LoremIpsum word];
			data.allowsTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.detailText = [LoremIpsum sentencesWithNumber:2];
			data.allowsDetailTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum word];
			data.detailText = [LoremIpsum sentencesWithNumber:2];
			data.allowsDetailTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.text = [LoremIpsum sentencesWithNumber:2];
			data.detailText = [LoremIpsum sentencesWithNumber:2];
			data.allowsTextLineWrapping = YES;
			data.allowsDetailTextLineWrapping = YES;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.detailText = [LoremIpsum word];
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		if (YES) {
			TableViewCellData *data = [[TableViewCellData alloc] init];
			data.style = UITableViewCellStyleSubtitle;
			data.image = [RandomUtils nextBoolean] ? nil : [DrawUtils tableViewCellImageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]];
			if ([RandomUtils nextBoolean]) {
				data.accessoryType = arc4random_uniform(5);
			} else {
				[data setAccessoryViewBlock:^UIView *(UITableView *tableView, NSIndexPath *indexPath, TableViewCellData *data){
					return [[UIImageView alloc] initWithImage:[DrawUtils imageWithFAKIcon:[RandomUtils nextIcon:24] fillColor:[UIColor blackColor]]];
				}];
			}
			data.detailText = [LoremIpsum sentencesWithNumber:2];
			data.allowsDetailTextLineWrapping = YES;
			data.editingType = TableViewCellEditingTypeTextField;
			[array addObject:data];
		}
		[arrays addObject:array];
	}
	self.cellDataArrays = arrays;

	NSMutableArray *array = [NSMutableArray array];
	if (self.cellDataArrays.count > 0) {
		TableViewSectionHeaderFooterData *data = [[TableViewSectionHeaderFooterData alloc] init];
		data.title = [LoremIpsum word];
		[array addObject:data];
	}
	if (self.cellDataArrays.count > 1) {
		TableViewSectionHeaderFooterData *data = [[TableViewSectionHeaderFooterData alloc] init];
		data.title = [LoremIpsum sentencesWithNumber:2];
		[array addObject:data];
	}
	if (self.cellDataArrays.count > 2) {
		TableViewSectionHeaderFooterData *data = [[TableViewSectionHeaderFooterData alloc] init];
		data.title = [LoremIpsum sentencesWithNumber:2];
		data.preserveCase = YES;
		[array addObject:data];
	}
	if (self.cellDataArrays.count > 3) {
		TableViewSectionHeaderFooterData *data = [[TableViewSectionHeaderFooterData alloc] init];
		data.attributedTitle = [[NSAttributedString alloc] im_initWithString:[LoremIpsum sentencesWithNumber:2] attributes:@{NSForegroundColorAttributeName : [RandomUtils nextColor]}];
		[array addObject:data];
	}
	self.headerDataArray = array;
}

 #pragma mark - Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
	return self.cellDataArrays.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [self.cellDataArrays[section] count];
}

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
	NSMutableArray *array = [NSMutableArray array];
	for (int i = 0; i < self.cellDataArrays.count; i++) {
		[array addObject:[NSString stringWithFormat:@"%d", i]];
	}
	return array;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
	TableViewSectionHeaderFooterData *data = self.headerDataArray[section];
	return [UIToolkit tableView:tableView inSection:section headerHeightWithData:data];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
	TableViewSectionHeaderFooterData *data = self.headerDataArray[section];
	return [UIToolkit tableView:tableView inSection:section headerTitleWithData:data];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
	TableViewSectionHeaderFooterData *data = self.headerDataArray[section];
	return [UIToolkit tableView:tableView inSection:section headerViewWithData:data];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	TableViewCellData *data = self.cellDataArrays[indexPath.section][indexPath.row];
	return [UIToolkit tableView:tableView atIndexPath:indexPath rowHeightWithData:data];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
	TableViewCellData *data = self.cellDataArrays[indexPath.section][indexPath.row];
	return [UIToolkit tableView:tableView atIndexPath:indexPath cellWithData:data];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
	NSLog(@"%@ %@ %@ %@ %@", cell.class, cell.textLabel.class, cell.detailTextLabel.class, NSStringFromCGRect(cell.textLabel.frame), NSStringFromCGRect(cell.detailTextLabel.frame));
	[tableView deselectRowAtIndexPath:indexPath animated:YES];
	TableViewCellData *data = self.cellDataArrays[indexPath.section][indexPath.row];
	[UIToolkit tableView:tableView atIndexPath:indexPath didSelectWithData:data];
}

@end

#endif

@implementation BusUnit

+ (UIViewController *)simulatedViewController {
#if DEBUG
	// [self stubRequest];
	if (NO) {
		CalendarViewController *viewController = [CalendarViewController new];
		viewController.allowsRangeSelection = YES;
		viewController.calendarManager.minimumDate = [NSDate date];
		viewController.calendarManager.maximumDate = [DateUtils addDays:[NSDate date] amount:30];
		[viewController setDidDoneRangeBlock:^(NSDate *startDate, NSDate *endDate) {
			;
		}];
		[viewController selectRangeFromStartDate:[DateUtils addDays:[NSDate date] amount:5] toEndDate:[DateUtils addDays:[NSDate date] amount:10]];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		ComboBoxViewController *viewController = [ComboBoxViewController new];
		[viewController setItemsWithDictionary:[NSDictionary dictionaryWithObjects:[Address availableCountryNames] forKeys:[Address availableCountryCodes]]];
		if (NO) {
			viewController.selectionTitle = [LoremIpsum word];
			viewController.suggestionTitle = [LoremIpsum word];
			viewController.historyTitle = [LoremIpsum word];
			[viewController suggestValues:@[[RandomUtils nextObject:[Address availableCountryCodes]]]];
			[viewController setHistoryValues:@[[RandomUtils nextObject:[Address availableCountryCodes]], [RandomUtils nextObject:[Address availableCountryCodes]]]];
			viewController.allowsMultipleSelection = YES;
		} else {
			viewController.allowsIndexedCollation = YES;
			viewController.allowsDeselection = YES;
		}
		[viewController selectValue:[RandomUtils nextObject:[Address availableCountryCodes]]];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		AutoCompleteViewController *viewController = [AutoCompleteViewController new];
		[viewController setItemsWithArray:[Address availableCountryNames]];
		[viewController searchString:[RandomUtils nextObject:[Address availableCountryNames]]];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		DropDownViewController *viewController = [DropDownViewController new];
		[viewController setItemsWithValues:[Address availableCountryCodes] andLabels:[Address availableCountryNames]];
		[viewController selectValues:@[[RandomUtils nextObject:[Address availableCountryCodes]]]];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		MapViewController *viewController = [MapViewController new];
		MapViewAnnotation *annotation = [MapViewAnnotation new];
		annotation.coordinate = CLLocationCoordinate2DMake(40.730610, -73.935242);
		annotation.title = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
		annotation.subtitle = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
		annotation.pinTintColor = [MKPinAnnotationView redPinColor];
		[viewController addAnnotation:annotation];
		[viewController selectAnnotation:annotation];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SelectLocationViewController *viewController = [[SelectLocationViewController alloc] init];
		viewController.isArrival = NO;
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			NSMutableArray *annotations = [NSMutableArray array];
			for (int j = 0; j < arc4random_uniform(5) + 1; j++) {
				MapViewAnnotation *annotation = [MapViewAnnotation new];
				annotation.coordinate = [RandomUtils nextCoordinate:CLLocationCoordinate2DMake(40.730610, -73.935242)];
				annotation.label = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.value = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.title = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.subtitle = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.pinTintColor = [MKPinAnnotationView redPinColor];
				[annotations addObject:annotation];
			}
			[viewController addAnnotations:annotations title:[LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1] isArrival:NO];
		}
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			NSMutableArray *annotations = [NSMutableArray array];
			for (int j = 0; j < arc4random_uniform(5) + 1; j++) {
				MapViewAnnotation *annotation = [MapViewAnnotation new];
				annotation.coordinate = [RandomUtils nextCoordinate:CLLocationCoordinate2DMake(38.89511, -77.03637)];
				annotation.label = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.value = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.title = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.subtitle = [LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1];
				annotation.pinTintColor = [MKPinAnnotationView redPinColor];
				[annotations addObject:annotation];
			}
			[viewController addAnnotations:annotations title:[LoremIpsum wordsWithNumber:arc4random_uniform(5) + 1] isArrival:YES];
		}
		[viewController selectAnnotation:[RandomUtils nextObject:[viewController getAnnotationsIsArrival:NO]] isArrival:NO];
		[viewController selectAnnotation:[RandomUtils nextObject:[viewController getAnnotationsIsArrival:YES]] isArrival:YES];
		[viewController setDidDoneDepartureAndArrivalBlock:^(MapViewAnnotation *departureAnnotation, MapViewAnnotation *arrivalAnnotation) {
			if (!departureAnnotation) {
				return;
			}
			if (!arrivalAnnotation) {
				return;
			}
		}];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		NSMutableArray *addresses = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			Address *address = [Address randomAddressWithType:AddressTypeContactInfo];
			address.aid = abs((int)[LoremIpsum word].hash);
			address.isDefault = NO;
			[addresses addObject:address];
		}
		if ([RandomUtils nextBoolean]) {
			Address *address = [RandomUtils nextObject:addresses];
			address.isDefault = YES;
		}
		AddressListViewController *viewController = [AddressListViewController new];
		viewController.addressType = AddressTypeContactInfo;
		viewController.addresses = addresses;
		viewController.allowsDefault = YES;
		// viewController.allowsTransient = YES;
		// viewController.allowsSelection = YES;
		// viewController.isSelection = YES;
		[viewController selectAddress:[RandomUtils nextObject:addresses]];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		NSMutableArray *creditCards = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			CreditCard *creditCard = [CreditCard randomCreditCard];
			creditCard.ccid = abs((int)[LoremIpsum word].hash);
			creditCard.isDefault = NO;
			[creditCards addObject:creditCard];
		}
		if ([RandomUtils nextBoolean]) {
			CreditCard *creditCard = [RandomUtils nextObject:creditCards];
			creditCard.isDefault = YES;
		}
		CreditCardListViewController *viewController = [CreditCardListViewController new];
		viewController.creditCards = creditCards;
		// viewController.allowsTransient = YES;
		// viewController.allowsSelection = YES;
		// viewController.isSelection = YES;
		[viewController selectCreditCard:[RandomUtils nextObject:creditCards]];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		RoomBasedPrice *roomPrice = [[RoomBasedPrice alloc] init];
		roomPrice.enable_child = [RandomUtils nextBoolean];
		roomPrice.enable_infant = [RandomUtils nextBoolean];
		roomPrice.min_people_num = 1;
		roomPrice.max_people_num = 10;
		roomPrice.max_child_num = roomPrice.enable_child ? 4 : 0;
		roomPrice.max_infant_num = roomPrice.enable_infant ? 4 : 0;
		roomPrice.min_adult_num = 1;
		roomPrice.max_adult_num = roomPrice.max_people_num - roomPrice.max_child_num - roomPrice.max_infant_num;
		roomPrice.child_age_from = 1;
		roomPrice.child_age_to = 12;
		NSMutableArray *array = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(4) + 1; ++i) {
			RoomBasedCountData *roomData = [[RoomBasedCountData alloc] initWithRoomNo:i + 1];
			[roomData configureWithRoomBasedPrice:roomPrice];
			[array addObject:roomData];
		}
		RoomBasedCountViewController *viewController = [[RoomBasedCountViewController alloc] initWithRoomBasedCountDatas:array];
		[viewController setPropertiesWithRoomBasedPrice:roomPrice];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		PassportViewController *viewController = [[PassportViewController alloc] initWithPassport:[[Passport alloc] initAsDistinguish]];
		viewController.readonly = NO;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		FlightInfo *flightInfo = [[FlightInfo alloc] init];
		flightInfo.is_to_be_advised = YES;
		FlightInfoViewController *viewController = [[FlightInfoViewController alloc] initWithFlightInfo:flightInfo];
		viewController.readonly = NO;
		// viewController.allowIfAdvisedWhileEditing = YES;
		viewController.allowIfNeededWhileEditing = YES;
		viewController.arrivalAirportOptions = @[[LoremIpsum word], [LoremIpsum word], [LoremIpsum word]];
		viewController.returnAirportOptions = @[[LoremIpsum word], [LoremIpsum word], [LoremIpsum word]];
		viewController.notNeedFlightOptions = @[[LoremIpsum word], [LoremIpsum word], [LoremIpsum word]];
		viewController.airportPickUpTip = [LoremIpsum sentencesWithNumber:arc4random_uniform(3) + 1];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		LoginViewController *viewController = [[LoginViewController alloc] init];
		viewController.pushFromBook = YES;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BusHotelSearchBoxViewController *viewController = [[BusHotelSearchBoxViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BusVendorReviewListViewController *viewController = [[BusVendorReviewListViewController alloc] init];
		viewController.vendorId = 4305;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		for (int i = 0; i < 3; i++) {
			CartEntry *entry = [[CartEntry alloc] init];
			if (i != 2) {
				entry.product.p_type = 1;
				entry.product.schedule_id = [LoremIpsum word];
				entry.product.vendor_obj.short_name = [LoremIpsum wordsWithNumber:3];
				entry.product.busRouteName = [LoremIpsum wordsWithNumber:3];
				PPLBasedCountData *countData = [[PPLBasedCountData alloc] init];
				countData.adultCount = arc4random_uniform(5) + 1;
				entry.product.PPLBasedPrice = [[PPLBasedPrice alloc] init];
				entry.product.PPLBasedPrice.enable_child = YES;
				entry.product.PPLBasedPrice.child_age_from = 2;
				entry.product.PPLBasedPrice.child_age_to = 16;
				countData.childCount = arc4random_uniform(5);
				entry.product.PPLBasedPrice.enable_infant = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_senior = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_junior = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_student = [RandomUtils nextBoolean];
				countData.infantCount = entry.product.PPLBasedPrice.enable_infant ? arc4random_uniform(5) : 0;
				countData.seniorCount = entry.product.PPLBasedPrice.enable_senior ? arc4random_uniform(5) : 0;
				countData.juniorCount = entry.product.PPLBasedPrice.enable_junior ? arc4random_uniform(5) : 0;
				countData.studentCount = entry.product.PPLBasedPrice.enable_student ? arc4random_uniform(5) : 0;
				entry.PPLBasedCountData = countData;
				entry.options[@"date"] = [DateFormatUtils format:[DateUtils addDays:[NSDate date] amount:i == 0 ? 0 : arc4random_uniform(7) + 1] pattern:@"yyyy-MM-dd EEE"];
				entry.options[@"departure"] = [LoremIpsum sentence];
				entry.options[@"arrival"] = [LoremIpsum sentence];
			} else {
				entry.product.p_type = 8;
				entry.product.name = [LoremIpsum sentence];
				entry.product.roomBasedPrice = [[RoomBasedPrice alloc] init];
				entry.product.roomBasedPrice.enable_child = YES;
				NSMutableArray *countDatas = [NSMutableArray array];
				for (int j = 0; j < arc4random_uniform(5) + 1; j++) {
					RoomBasedCountData *countData = [[RoomBasedCountData alloc] initWithRoomNo:j + 1];
					countData.adultCount = [Vars appDelegate].shopCarts.adultNum;
					countData.childCount = [Vars appDelegate].shopCarts.childNum;
					[countDatas addObject:countData];
				}
				entry.roomBasedCountDatas = countDatas;
				entry.options[@"date"] = @{ @"checkIn" : ((CartEntry *)[Vars appDelegate].shopCarts.entries.firstObject).options[@"date"], @"checkOut" : ((CartEntry *)[Vars appDelegate].shopCarts.entries.lastObject).options[@"date"] };
				entry.options[@"roomTypeId"] = @([LoremIpsum word].hash);
				entry.options[@"roomType"] = [LoremIpsum word];
				for (SalesEntryRoom *room in entry.rooms) {
					room.room_type = entry.options[@"roomType"];
					room.check_in = entry.options[@"date"][@"checkIn"];
					room.check_out = entry.options[@"date"][@"checkOut"];
					room.checkin_guest = [[SoldStock alloc] init];
					room.checkin_guest.gender = @"Mr.";
				}
			}
			[[Vars appDelegate].shopCarts.entries addObject:entry];
		}

		CheckAvailabilityAndPricesResponse *response = [[CheckAvailabilityAndPricesResponse alloc] init];
		response.entries = [[Vars appDelegate].shopCarts.entries bk_map:^id (CartEntry *entry) {
			_Entry *_entry = [_Entry new];
			_entry.service_fee_and_tax = [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.roundtrip_discount = entry.product.is_bus && [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.coupon_discount = entry.product.is_bus && [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.bus_hotel_package_saving = entry.product.is_hotel ? arc4random_uniform(99) + 1 : 0;
			if (entry.product.is_bus) {
				NSMutableArray *peopleTypes = [NSMutableArray array];
				[[PPLBasedPrice defaultPossibleTypes] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
					GetProductOptionsResponsePeopleType *peopleType = [GetProductOptionsResponsePeopleType new];
					peopleType.name = [obj lowercaseString];
					peopleType.peoplePrice = arc4random_uniform(99) + 1;
					if (idx == 0 || [[entry.product.PPLBasedPrice valueForKeyPath:[NSString stringWithFormat:@"enable_%@", peopleType.name]] boolValue]) {
						[peopleTypes addObject:peopleType];
					}
				}];
				_entry.people_types = peopleTypes;
				_entry.total_charge = [_entry.people_types bk_reduceFloat:0 withBlock:^CGFloat (CGFloat result, GetProductOptionsResponsePeopleType *peopleType) {
					return result + [[entry.PPLBasedCountData valueForKeyPath:[NSString stringWithFormat:@"%@Count", peopleType.name]] intValue] * peopleType.peoplePrice;
				}];
			} else {
				_entry.total_charge = arc4random_uniform(9999) + 1;
			}
			_entry.is_dynamic_price = [RandomUtils nextBoolean];
			_entry.non_refundable = entry.product.is_bus && [RandomUtils nextBoolean];
			_entry.paid_separately = entry.product.is_bus && [RandomUtils nextBoolean];
			return _entry;
		}];
		response.default_currency_charge = [response.entries bk_reduceFloat:0 withBlock:^CGFloat (CGFloat result, _Entry *obj) {
			return result + obj.total_charge;
		}];

		BookingReviewViewController *viewController = [[BookingReviewViewController alloc] init];
		viewController.checkAvailabilityAndPricesResponse = response;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		NSMutableArray *addresses = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			Address *address = [Address randomAddressWithType:AddressTypeContactInfo];
			address.aid = abs((int)[LoremIpsum word].hash);
			address.isDefault = NO;
			[addresses addObject:address];
		}
		if ([RandomUtils nextBoolean]) {
			Address *address = [RandomUtils nextObject:addresses];
			address.isDefault = YES;
		}
		NSMutableArray *creditCards = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			CreditCard *creditCard = [CreditCard randomCreditCard];
			creditCard.ccid = abs((int)[LoremIpsum word].hash);
			creditCard.isDefault = NO;
			[creditCards addObject:creditCard];
		}
		if ([RandomUtils nextBoolean]) {
			CreditCard *creditCard = [RandomUtils nextObject:creditCards];
			creditCard.isDefault = YES;
		}
		User *user = [[User alloc] init];
		user.id = abs((int)[LoremIpsum word].hash);
		user.uid = [LoremIpsum word];
		user.pass1 = [LoremIpsum word];
		user.role = 1;
		user.email = [NSString stringWithFormat:@"%@@%@", [LoremIpsum word], [Vars site_title].lowercaseString];
		user.creditCards = creditCards;
		user.contactInfos = addresses;
		[Vars appDelegate].loginUser = user;

		for (int i = 0; i < 2; i++) {
			CartEntry *entry = [[CartEntry alloc] init];
			if (i != 2) {
				entry.product.p_type = 1;
				entry.product.vendor = [[RandomUtils nextObject:@[@2092129, @4305, @2227179, @1680729]] integerValue];;
				entry.product.vendor_obj.id = entry.product.vendor;
				entry.product.vendor_obj.short_name = [LoremIpsum wordsWithNumber:3];
				PPLBasedCountData *countData = [[PPLBasedCountData alloc] init];
				countData.adultCount = arc4random_uniform(5) + 1;
				entry.product.PPLBasedPrice = [[PPLBasedPrice alloc] init];
				entry.product.PPLBasedPrice.enable_child = YES;
				countData.childCount = arc4random_uniform(5);
				entry.product.PPLBasedPrice.enable_infant = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_senior = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_junior = [RandomUtils nextBoolean];
				entry.product.PPLBasedPrice.enable_student = [RandomUtils nextBoolean];
				countData.infantCount = entry.product.PPLBasedPrice.enable_infant ? arc4random_uniform(5) : 0;
				countData.seniorCount = entry.product.PPLBasedPrice.enable_senior ? arc4random_uniform(5) : 0;
				countData.juniorCount = entry.product.PPLBasedPrice.enable_junior ? arc4random_uniform(5) : 0;
				countData.studentCount = entry.product.PPLBasedPrice.enable_student ? arc4random_uniform(5) : 0;
				entry.PPLBasedCountData = countData;
				entry.options[@"date"] = [DateFormatUtils format:[DateUtils addDays:[NSDate date] amount:i == 0 ? 0 : arc4random_uniform(7) + 1] pattern:@"yyyy-MM-dd EEE"];
			} else {
				entry.product.p_type = 8;
				NSMutableArray *countDatas = [NSMutableArray array];
				for (int j = 0; j < arc4random_uniform(5) + 1; j++) {
					RoomBasedCountData *countData = [[RoomBasedCountData alloc] initWithRoomNo:j + 1];
					countData.adultCount = [Vars appDelegate].shopCarts.adultNum;
					countData.childCount = [Vars appDelegate].shopCarts.childNum;
					[countDatas addObject:countData];
				}
				entry.roomBasedCountDatas = countDatas;
				entry.options[@"date"] = @{ @"checkIn" : ((CartEntry *)[Vars appDelegate].shopCarts.entries.firstObject).options[@"date"], @"checkOut" : ((CartEntry *)[Vars appDelegate].shopCarts.entries.lastObject).options[@"date"] };
			}
			[[Vars appDelegate].shopCarts.entries addObject:entry];
		}

		CheckAvailabilityAndPricesResponse *response = [[CheckAvailabilityAndPricesResponse alloc] init];
		response.entries = [[Vars appDelegate].shopCarts.entries bk_map:^id (CartEntry *entry) {
			_Entry *_entry = [_Entry new];
			_entry.service_fee_and_tax = [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.coupon_discount = [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.roundtrip_discount = entry.product.is_bus && [RandomUtils nextBoolean] ? arc4random_uniform(99) + 1 : 0;
			_entry.bus_hotel_package_saving = entry.product.is_hotel ? arc4random_uniform(99) + 1 : 0;
			if (entry.product.is_bus) {
				NSMutableArray *peopleTypes = [NSMutableArray array];
				[[PPLBasedPrice defaultPossibleTypes] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
					GetProductOptionsResponsePeopleType *peopleType = [GetProductOptionsResponsePeopleType new];
					peopleType.name = [obj lowercaseString];
					peopleType.peoplePrice = arc4random_uniform(99) + 1;
					if (idx == 0 || [[entry.product.PPLBasedPrice valueForKeyPath:[NSString stringWithFormat:@"enable_%@", peopleType.name]] boolValue]) {
						[peopleTypes addObject:peopleType];
					}
				}];
				_entry.people_types = peopleTypes;
				_entry.total_charge = [_entry.people_types bk_reduceFloat:0 withBlock:^CGFloat (CGFloat result, GetProductOptionsResponsePeopleType *people_type) {
					return result + [[entry.PPLBasedCountData valueForKeyPath:[NSString stringWithFormat:@"%@Count", people_type.name]] intValue] * people_type.peoplePrice;
				}];
			} else {
				_entry.total_charge = arc4random_uniform(9999) + 1;
			}
			_entry.is_dynamic_price = [RandomUtils nextBoolean];
			_entry.non_refundable = entry.product.is_bus && [RandomUtils nextBoolean];
			_entry.paid_separately = entry.product.is_bus && [RandomUtils nextBoolean];
			return _entry;
		}];
		response.default_currency_charge = [response.entries bk_reduceFloat:0 withBlock:^CGFloat (CGFloat result, _Entry *obj) {
			return result + obj.total_charge;
		}];
		response.default_currency_code = @"usd";
		response.second_currency_code = @"cny";
		response.second_currency_rate = (arc4random_uniform(9999) + 1) / 100.0;
		response.second_currency_discount = arc4random_uniform(99) + 1;

		BookingCheckoutViewController *viewController = [[BookingCheckoutViewController alloc] init];
		viewController.checkAvailabilityAndPricesResponse = response;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		NSString *responseStr = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.txt", @"/Users/haibara/Documents/Units", @"BookBusResponse"] encoding:NSUTF8StringEncoding error:NULL];
		BookGoodsResponseJsonMapper *mapper = [[BookGoodsResponseJsonMapper alloc] init];
		NSDictionary *jsonDict = [Utility JSONObjectWithXMLString:responseStr objectMapping:mapper.objectMapping];
		[mapper parseWithJSONObject:jsonDict];
		BookingFinishViewController *viewController = [[BookingFinishViewController alloc] init];
		viewController.bookGoodsResponse = mapper.response;
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BookGoodsResponse *response = [BookGoodsResponse new];
		response.post_sale_html = @"<div class=\"bordercolor clearfix widget\" style=\"padding:20px\"><p><strong class=\"font20\">We have received your order.</strong></p><p><strong>However, due to a security concern with the payment on this credit card, we kindly need to request further verification from your side. We will contact you soon via email.</strong></p><p><strong>If this is an urgent booking, please contact us at 617-354-2101 or email us at haibara@gotobus.com.</strong></p></div>";
		SecurityAttentionViewController *viewController = [[SecurityAttentionViewController alloc] init];
		viewController.bookGoodsResponse = response;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SecurityVerificationViewController *viewController = [[SecurityVerificationViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SelfCheckInSearchViewController *viewController = [[SelfCheckInSearchViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SoldStock *stock = [SoldStock new];
		stock.stock_id = abs((int)[LoremIpsum word].hash);
		stock.sold_to_name = [LoremIpsum wordsWithNumber:2];
		stock.cn = [LoremIpsum word];
		stock.boarding_number = [LoremIpsum word];
		stock.desc[@"departure"] = [LoremIpsum sentence];
		stock.desc[@"arrival"] = [LoremIpsum sentence];

		Product *product = [Product new];
		product.busRouteName = [LoremIpsum sentence];

		SalesEntry *entry = [SalesEntry new];
		entry.service_date = [[DateFormatUtils ISO_DATE_FORMAT] format:[NSDate date]];
		entry.product = product;
		entry.stocks = @[stock];

		User *user = [User new];
		user.block_status = arc4random_uniform(4) + 1;

		Sales *order = [Sales new];
		order.user = user;
		order.entries = @[entry];

		[Vars appDelegate].loginUser = [User new];
		[Vars appDelegate].loginUser.block_status = arc4random_uniform(4) + 1;

		BusCheckInViewController *viewController = [[BusCheckInViewController alloc] init];
		viewController.entry = entry;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		TrackBusStatusViewController *viewController = [[TrackBusStatusViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BusStatusInfoResultViewController *viewController = [[BusStatusInfoResultViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		PurchaseRecordViewController *viewController = [[PurchaseRecordViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SoldStockBarcodeViewController *viewController = [[SoldStockBarcodeViewController alloc] init];
		Vendor *vendor_obj = [Vendor new];
		vendor_obj.barcode_type = 1;
		Product *product = [Product new];
		product.vendor_obj = vendor_obj;
		SalesEntry *entry = [SalesEntry new];
		entry.product = product;
		SoldStock *stock = [SoldStock new];
		stock.sold_to_name = [LoremIpsum wordsWithNumber:2];
		stock.cn = [LoremIpsum word];
		stock.barcode = [LoremIpsum word];
		stock.entry = entry;
		viewController.stock = stock;
		NSLog(@"%@", (__bridge_retained void *)entry);
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BusVendorReviewDetailViewController *viewController = [[BusVendorReviewDetailViewController alloc] init];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		TextViewController *viewController = [[TextViewController alloc] init];
		viewController.textView.attributedText = [BusVendorReviewDetailViewController attributedFinishTextWithOverallRating:arc4random_uniform(5) + 1 byVendorName:[LoremIpsum word]];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		ReschedulePolicyViewController *viewController = [[ReschedulePolicyViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		Product *product = [Product new];
		product.product_id = abs((int)[LoremIpsum word].hash);
		product.name = [LoremIpsum sentence];
		product.schedule_id = [LoremIpsum word];
		NSMutableArray *stops = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			Destination *destination = [Destination new];
			destination.show_name = [LoremIpsum word];
			BusStation *station = [BusStation new];
			station.destination = destination;
			BusStop *stop = [BusStop new];
			stop.reference = [LoremIpsum word].hash;
			stop.time_value = [NSString stringWithFormat:@"%02d:%02d", arc4random_uniform(24), arc4random_uniform(60)];
			stop.option_value = [LoremIpsum wordsWithNumber:2];
			stop.station = station;
			[stops addObject:stop];
		}
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			Destination *destination = [Destination new];
			destination.show_name = [LoremIpsum word];
			BusStation *station = [BusStation new];
			station.destination = destination;

			BusStop *stop = [BusStop new];
			stop.reference = [LoremIpsum word].hash;
			stop.time_value = [NSString stringWithFormat:@"%02d:%02d", arc4random_uniform(24), arc4random_uniform(60)];
			stop.option_value = [LoremIpsum wordsWithNumber:2];
			stop.is_arrival = YES;
			stop.station = station;
			[stops addObject:stop];
		}
		product.stops = [NSArray arrayWithArray:stops];
		Sales *sales = [Sales new];
		sales.order_code = [LoremIpsum word];;
		SalesEntry *entry = [SalesEntry new];
		entry.product = product;
		entry.service_date = [[DateFormatUtils ISO_DATE_FORMAT] format:[NSDate date]];
		entry.sold_amount = arc4random_uniform(999) + 1;
		entry.order = sales;
		NSMutableArray *stocks = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(5) + 1; i++) {
			SoldStock *stock = [SoldStock new];
			stock.sold_to_name = [LoremIpsum wordsWithNumber:2];
			stock.cn = [LoremIpsum word];
			stock.entry = entry;
			NSMutableDictionary *dict = [NSMutableDictionary dictionary];
			BusStop *departureStop = [RandomUtils nextObject:product.departureStops];
			BusStop *arrivalStop = [RandomUtils nextObject:product.arrivalStops];
			dict[@"departure"] = departureStop.option_value;
			dict[@"arrival"] = arrivalStop.option_value;
			stock.desc = dict;
			[stocks addObject:stock];
		}
		entry.stocks = [NSArray arrayWithArray:stocks];
		BusRescheduleViewController *viewController = [[BusRescheduleViewController alloc] init];
		viewController.entry = entry;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		_PaymentInfo *paymentInfo = [_PaymentInfo new];
		if ([RandomUtils nextBoolean]) {
			paymentInfo.charge_message = [LoremIpsum sentence];
			paymentInfo.credit_card = [CreditCard randomCreditCard];
		}
		if ([RandomUtils nextBoolean]) {
			paymentInfo.total_refund_message = [LoremIpsum sentence];
			paymentInfo.global_refund_alert = [LoremIpsum sentence];
			for (int i = 0; i < arc4random_uniform(3) + 1; i++) {
				_RefundTransaction *refundTransaction = [_RefundTransaction new];
				refundTransaction.merchant = [LoremIpsum word];
				refundTransaction.refund_amount = arc4random_uniform(99) + 1;
				refundTransaction.card_number = [RandomStringUtils randomNumeric:16];
				refundTransaction.last_digits_length = 4;
			}
		}
		PaymentInfoViewController *viewController = [[PaymentInfoViewController alloc] init];
		viewController.paymentInfo = paymentInfo;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		SoldStockListViewController *viewController = [[SoldStockListViewController alloc] init];
		viewController.allowsCheckIn = YES;
		viewController.isCheckIn = YES;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		VendorDatePickController *viewController = [[VendorDatePickController alloc] init];
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		ProductPickViewController *viewController = [[ProductPickViewController alloc] init];
		viewController.service_date = [[DateFormatUtils ISO_DATE_FORMAT] format:[NSDate date]];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		BusStatusEditViewController *viewController = [[BusStatusEditViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		NSMutableArray *stocks = [NSMutableArray array];
		for (int i = 0; i < arc4random_uniform(25) + 1; i++) {
			SoldStock *stock = [SoldStock new];
			stock.sold_to_name = [LoremIpsum wordsWithNumber:2];
			stock.cn = [LoremIpsum word];
			stock.vendor_checkin = [RandomUtils nextBoolean];
			stock.departure = [LoremIpsum sentence];
			stock.arrival = [LoremIpsum sentence];
			stock.soldDate = [[DateFormatUtils ISO_DATETIME_FORMAT] format:[NSDate date]];
			stock.soldTime = [[DateFormatUtils ISO_DATETIME_FORMAT] format:[NSDate date]];
			stock.soldValue = arc4random_uniform(99) + 1;
			stock.customerHomePhone = [LoremIpsum word];
			stock.creditCardNumber = [LoremIpsum word];
			stock.blockStatus = arc4random_uniform(4) + 1;
			[stocks addObject:stock];
		}
		SchedulePassengerListViewController *viewController = [[SchedulePassengerListViewController alloc] init];
		viewController.allowsCheckIn = YES;
		viewController.soldStocks = stocks;
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		Product *product = [Product new];
		product.product_id = abs((int)[LoremIpsum word].hash);
		SalesEntry *entry = [SalesEntry new];
		entry.service_date = [[DateFormatUtils ISO_DATE_FORMAT] format:[NSDate date]];
		entry.product = product;
		SoldStock *stock = [[SoldStock alloc] init];
		stock.sold_to_name = [LoremIpsum word];
		stock.cn = [LoremIpsum word];
		// stock.vendor_checkin = YES;
		// stock.checked = YES;
		stock.entry = entry;
		CheckInResultViewController *viewController = [[CheckInResultViewController alloc] init];
		viewController.product_id = product.product_id;
		viewController.service_date = entry.service_date;
		viewController.stock = stock;
		return [self wrappingTabBarControllerOnNavigationPushingViewController:viewController atTop:YES];
	} else if (NO) {
		ScheduleDriverSearchViewController *viewController = [[ScheduleDriverSearchViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		ScheduleDriverLocationViewController *viewController = [[ScheduleDriverLocationViewController alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		TableViewDataVC *viewController = [[TableViewDataVC alloc] init];
		return [self wrappingNavigationControllerPushingViewController:viewController atTop:YES];
	} else if (NO) {
		UIViewController *vc = [UIViewController new];
		UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
		[button setTitle:NSStringFromClass([PayPalPaymentViewController class]) forState:UIControlStateNormal];
		[button bk_addEventHandler:^(id sender) {
			[PayPalMobile preconnectWithEnvironment:PayPalEnvironmentSandbox];
			PayPalConfiguration *paypalconfig = [[PayPalConfiguration alloc] init];
			paypalconfig.acceptCreditCards = NO;
			paypalconfig.languageOrLocale = @"en";
			PayPalPayment *payment = [PayPalPayment paymentWithAmount:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%g", arc4random_uniform(9999) + 1]] currencyCode:@"USD" shortDescription:[NSString stringWithFormat:@"%@ Order", [Vars site_name]] intent:PayPalPaymentIntentSale];
			payment.invoiceNumber = [LoremIpsum word];
			PayPalPaymentViewController *viewController = [[PayPalPaymentViewController alloc] initWithPayment:payment configuration:paypalconfig delegate:[PayPalPaymentDelegateImpl sharedInstance]];
			[vc presentViewController:viewController animated:YES completion:nil];
		} forControlEvents:UIControlEventTouchUpInside];
		[vc.view addSubview:button];
		[button autoCenterInSuperview];
		return vc;
	} else if (NO) {
		UIViewController *vc = [UIViewController new];
		UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
		[button setTitle:NSStringFromClass([CardIOPaymentViewController class]) forState:UIControlStateNormal];
		[button bk_addEventHandler:^(id sender) {
			CardIOPaymentViewController *viewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:[CardIOPaymentViewControllerDelegateImpl sharedInstance]];
			viewController.languageOrLocale = [CocoaUtils applicationLocale].localeIdentifier;
			viewController.guideColor = [Vars defaultTintColor];
			viewController.hideCardIOLogo = YES;
			[vc presentViewController:viewController animated:YES completion:nil];
		} forControlEvents:UIControlEventTouchUpInside];
		[vc.view addSubview:button];
		[button autoCenterInSuperview];
		return vc;
	}
#endif
	return nil;
}

@end

