# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
#   movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
#   Character.create(name: 'Luke', movie: movies.first)

gateway_communication_type = Lookup.create([{lookup_type:'gateway_communication_type', name: 'API', value: 'api'},
                              {lookup_type:'gateway_communication_type', name: 'USB', value: 'usb'}])

payment_methods = Lookup.create([{lookup_type:'payment_methods', name: 'Cash', value: 'cash'},
                                 {lookup_type:'payment_methods', name: 'CreditNote', value: 'creditnote'},
                                 {lookup_type:'payment_methods', name: 'Card - VISA', value: 'visa'},
                                 {lookup_type:'payment_methods', name: 'Card - MASTER', value: 'master'},
                                 {lookup_type:'payment_methods', name: 'Card - JCB', value: 'jcb'},
                                 {lookup_type:'payment_methods', name: 'Card - UnionPay', value: 'unionpay'},
                                 {lookup_type:'payment_methods', name: 'Card - MPU', value: 'jcb'},
                                 {lookup_type:'payment_methods', name: 'Vochure', value: 'vochure'},
                                 {lookup_type:'payment_methods', name: 'Giftcard', value: 'gift'}])

payment_status = Lookup.create([{lookup_type:'payment_status', name: 'New', value: 'new'},
                                {lookup_type:'payment_status', name: 'paid', value: 'paid'},
                                {lookup_type:'payment_status', name: 'Fail', value: 'fail'},
                                {lookup_type:'payment_status', name: 'Outstanding', value: 'outstanding'}])

sales_status = Lookup.create([{lookup_type:'sales_status', name: 'New', value: 'new'},
                              {lookup_type:'sales_status', name: 'Void', value: 'void'},
                              {lookup_type:'sales_status', name: 'Completed', value: 'completed'}])

order_status = Lookup.create([{lookup_type:'order_status', name: 'New', value: 'new'},
                              {lookup_type:'order_status', name: 'Completed', value: 'completed'}])

order_item_status = Lookup.create([{lookup_type:'order_item_status', name: 'New', value: 'new'},
                                  {lookup_type:'order_item_status', name: 'Processing', value: 'processing'},
                                  {lookup_type:'order_item_status', name: 'Served', value: 'served'}, {lookup_type:'order_item_status', name: 'BIlled', value: 'billed'}])

#order_source [tablet, order_station, emenu, api]
order_source = Lookup.create([{lookup_type:'order_source', name: 'API', value: 'api'},
                              {lookup_type:'order_source', name: 'Tablet', value: 'tablet'},
                              {lookup_type:'order_source', name: 'EMenu', value: 'emenu'},
                              {lookup_type:'order_source', name: 'Order Station', value: 'order_station'}])

#order_type [dine-in, takeaway, delivery]
order_type = Lookup.create([{lookup_type:'order_type', name: 'Dine-in', value: 'dine-in'},
                              {lookup_type:'order_type', name: 'Takeaway', value: 'takeaway'},
                              {lookup_type:'order_type', name: 'Delivery', value: 'delivery'}])

#menu_item_type:[simple| set| DIY]
menu_item_type = Lookup.create([{lookup_type:'menu_item_type', name: 'SIMPLE', value: 'simpleItem'},
                                {lookup_type:'menu_item_type', name: 'Set Menu', value: 'setMenu'},
                                {lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}])

member_group_type = Lookup.create([{lookup_type:'member_group_type', name: 'Normal', value: '1'}])

#menu_item_attribute:[size|]
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type', name: 'Size', value: 'size'}])
                                        #  {lookup_type:'menu_item_attribute_type', name: 'Spicy', value: 'spicy'},
                                        #  {lookup_type:'menu_item_attribute_type', name: 'Sweetness', value: 'sweetness'}])

#Employee Roles
employee_roles =  Lookup.create([{lookup_type:'employee_roles', name: 'Cashier', value: 'cashier'},
                                  {lookup_type:'employee_roles', name: 'Waiter', value: 'waiter'},
                                  {lookup_type:'employee_roles', name: 'Supervisour', value: 'supervisour'},
                                  {lookup_type:'employee_roles', name: 'Manager', value: 'manager'},
                                  {lookup_type:'employee_roles', name: 'Accountant', value: 'account'},
                                  {lookup_type:'employee_roles', name: 'Administrator', value: 'administrator'}])

#booking_status
booking_status = Lookup.create([{lookup_type:'booking_status', name: 'Available', value: 'available'},
                                {lookup_type:'booking_status', name: 'Reserved', value: 'reserved'},
                                {lookup_type:'booking_status', name: 'Occupied', value: 'occupied'},
                                {lookup_type:'booking_status', name: 'Cleaning', value: 'cleaning'},
                                {lookup_type:'booking_status', name: 'Moved', value: 'moved'}])

#booking_status
account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value: '0'},
                              {lookup_type:'account_type', name: 'Expense', value: '1'}])

# sale void reason
void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manager', value: 'Approve By Manager'},
                                {lookup_type:'void_reason', name: 'Customer Mistake', value: 'Customer Mistake'},
                                {lookup_type:'void_reason', name: 'Cashier Mistake', value: 'Cashier Mistake'},
                                {lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}])

    # sale void reason
  float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '500'},
                                    {lookup_type:'float_value', name: '1000', value: '1000'},
                                    {lookup_type:'float_value', name: '5000', value: '5000'},
                                    {lookup_type:'float_value', name: '10000', value: '10000'}])

#WALK CUSTOMER - Default CUSTOMER (take key 1)
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})


#Default ZOne
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
# zone2 = Zone.create({id:2, name: "VIP Zone", is_active:true, created_by: "SYSTEM DEFAULT"})

#Default dining_facilities
# table = Table.create({name:"Table 1", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
# room = Room.create({name:"Table 2", zone: zone2, status:"available", seater: 4 , order_by:1, created_by:"SYSTEM DEFAULT"})

#Tax Profile
tax_profiles = TaxProfile.create({id:1, name: "Commerical Tax", rate:5.0, order_by:1, created_by:"SYSTEM DEFAULT"})

#Account for Menu Item Type (eg: Food, Beverage)
# food = Account.create({title: "Food", account_type: "0"})
# beverage = Account.create({title: "Beverage", account_type: "1"})

#Default menu
# menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})

menu_options = MenuItemOption.create([{name: "Less Spicy", value: "less_spicy"},{name: "Spicy", value: "spicy"},{name: "Super Spicy", value: "super_spicy"}])
menu_options = MenuItemOption.create([{name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{name: "Less Sweet", value: "less_sweet"}])

# #Default Menu Category
# menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"})
# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"})
# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"})
# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
#
# #Default Menu items
# menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0041", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}])
#
# menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Twin Pot", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
# menu_category1_menu_item2 = SetMenuItem.create({item_code:"I005", name: "VIP Room Individual Pot",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 2", min_selectable_item: 1, max_selectable_item:1 , account: food})
# menu_category1_menu_item3 = SetMenuItem.create({item_code:"I006", name: "Default Menu Item Name 3",parent: menu_category1_menu_item1, alt_name: "Alternate Menu Item Name 3", min_selectable_item: 1, max_selectable_item:1 , account: food})
#
# menu_category2_menu_item0 = SimpleMenuItem.create({item_code:"I007", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food})
# menu_category2_menu_item1 = SimpleMenuItem.create({item_code:"I008", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 2 , account: food})
# menu_category2_menu_item2 = SimpleMenuItem.create({item_code:"I009", name: "Default Menu Item Name 2", alt_name: "Alternate Menu Item Name 2",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, min_qty: 3 , account: food})

menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size", name: "Small", value: "small"})
menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"})
menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"})

shop = Shop.create({id:1, name: "Beauty In the Pot", address:'No.42-A, Sayar San Road, Bahan, Yangon', township:"Bahan",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"+95(9) 252221188, +95(9) 252221177",reservation_no:"111",license:"123",
activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111"})
#Default Order Queue stations
# order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
# zone_order_queue_station = OrderQueueStation.create({station_name: "Zone 1 Queue Station 2", is_active: true, printer_name: "print_station", processing_items: JSON.generate(['01001','01002','01003','01004','02005','02006','02007','02008']), print_copy: true, cut_per_item: true, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})


#Default Order Queue Process By Zone
# zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone2})


#Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter 2", role: "waiter", password: "22222", emp_id:"222", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Cashier", role: "cashier", password: "33333", emp_id:"333", created_by: "SYSTEM DEFAULT"})

order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
close_cashier_printer=PrintSetting.create({name: "Close Cashier", unique_code: "CloseCashierPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})
queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf", printer_name: "Cashier", precision: "0", delimiter: "0", heading_space: "5"})

member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})

member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
  {membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}
  ])

payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})

cashier_terminal = CashierTerminal.create({name:"Terminal 1"})
cashier_terminal2 = CashierTerminal.create({name:"Terminal 2"})
cashier_terminal3 = CashierTerminal.create({name:"Terminal 3"})
puts " Finished System Default Set Up Data "
