//
//  MenuTableViewController.h
//  DUREX Vendor Control
//
//  Created by Imanol Barba on 5/23/14.
//  Copyright (c) 2014 Emmoco. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "EMFramework.h"
#import "CommunicationProtocol.h"
#import "Stack.h"
#import "DatePickerViewController.h"
#import "PriceChangerViewController.h"
#import "NameChangerViewController.h"
#import "DateRangePickerViewController.h"
#import "Sensors.h"
#import "SalesLog.h"
#import "IncidentLog.h"
#import "UIView+Toast.h"
#import "ChildViewController.h"

#define num(x) [NSNumber numberWithUnsignedInt:x]

#define BATCH_ALERT_TAG                 200

#define CELL_CARAT_TAG                  100

#define MENU_ELEMENTS                   @"[1000]Maintenance",@"[1001]Basic Configuration"
#define MENU_CELLS_PER_SECTION          num(2)
#define MENU_HEADERS                    nil

#define MAINTENANCE_ELEMENTS            @">[2000]Channels Present",@">[2001]Product Present in Channel",@">[2002]Channel Engine Status",@"[2003]Door Sensor",@"[2004]Coil Sensor",@">[2005]Money Collected",@">[2006]Money Returned",@">[2007]Products Sold",@">[2008]Change Available",@"[2009]Sales log",@"[2010]Incident report",@"[2011]Send report"
#define MAINTENANCE_CHANNELS            @"*Channel 1",@"*Channel 2",@"*Channel 3",@"*Channel 4",@"*Channel 5",@"*Channel 6",@"*Channel 7",@"*Channel 8",@"*Channel 9",@"*Channel 10",@"*Channel 11",@"*Channel 12",@"*Channel 13",@"*Channel 14",@"*Channel 15",@"*Channel 16"
#define MAINTENANCE_MONEY_IN            @"*20€ Notes",@"*10€ Notes",@"*5€ Notes",@"*2€ Coins",@"*1€ Coins",@"*50c Coins"
#define MAINTENANCE_MONEY_OUT           @"*2€ Coins",@"*1€ Coins",@"*50c Coins"
#define MAINTENANCE_CHANGE              @"*1€ Coins",@"*50c Coins"
#define MAINTENANCE_PRODUCTS            @"*Product 1",@"*Product 2",@"*Product 3",@"*Product 4",@"*Product 5",@"*Product 6",@"*Product 7",@"*Product 8",@"*Product 9",@"*Product 10",@"*Product 11",@"*Product 12",@"*Product 13",@"*Product 14",@"*Product 15",@"*Product 16"
#define MAINTENANCE_CELLS_PER_SECTION   num(9),num(3)
#define MAINTENANCE_HEADERS              NSLocalizedString(@"Sensors", nil),NSLocalizedString(@"Commands", nil)

#define SALE_ELEMENTS            @">[3000]Money Paid",@"[3001]Channel",@"[3002]Product Code",@"[3003]Product Price",@">[3004]Money Returned"
#define SALE_MONEY_PAID          @"*20€ Notes",@"*10€ Notes",@"*5€ Notes",@"*2€ Coins",@"*1€ Coins",@"*50c Coins"
#define SALE_MONEY_RETURNED      @"*2€ Coins",@"*1€ Coins",@"*50c Coins"
#define SALE_CELLS_PER_SECTION  num(5)
#define SALE_HEADERS             nil

#define INCIDENT_ELEMENTS            @">[5000]Error Code",@"[5001]Error Value"
#define INCIDENT_CELLS_PER_SECTION  num(2)
#define INCIDENT_HEADERS             nil

#define CONFIGURATION_ELEMENTS          @"[4000]Update Date & Time",@"[4001]Update product price",@"[4002]Update product name"
#define CONFIGURATION_CELLS_PER_SECTION num(3)
#define CONFIGURATION_HEADERS           nil

#define CELL_IDENTIFIERS                @"MenuCell",@"MaintenanceCell",@"SaleListCell",@"SaleCell",@"IncidentListCell",@"IncidentCell",@"ConfigCell",@"ReportCell"

enum {
    MENU = 0,
    MAINTENANCE,
    SALE_LIST,
    SALE,
    INCIDENT_LIST,
    INCIDENT,
    BASIC_CONFIGURATION,
    REPORT,
} navigationLevel;

enum {
    HELLO = 0,
    A2,
    A3,
    A4,
    A5,
    A6,
    A7,
    BATCH_COMMANDS,
    INVALID_COMMAND,
    NONE,
} commandTypes;

enum {
    SALES_LOG = 0,
    INCIDENT_LOG,
} logType;

@interface MenuTableViewController : UITableViewController <DatePickerViewControllerDelegate,PriceChangerViewControllerDelegate,NameChangerViewControllerDelegate, DateRangePickerViewControllerDelegate, CommunicationProtocolDelegate, NSURLConnectionDataDelegate, ChildViewControllerDelegate,UIAlertViewDelegate>

- (void) handleOpenURL: (NSURL*) url;

@end
