<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTablePlaces extends Migration
{

    public function up()
    {

        DB::statement("
         CREATE TABLE `property_place_category` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
        `language_key` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
        `parent_id` int(10) unsigned DEFAULT NULL,
        `level` tinyint(3) NOT NULL,
        `order_number` tinyint(3) NOT NULL DEFAULT '0',
        `icon` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
        `status` tinyint(3) unsigned NOT NULL DEFAULT '1',
        `created_by` int(10) unsigned NOT NULL,
        `updated_by` int(10) unsigned NOT NULL,
        `created_at` int(11) NOT NULL,
        `updated_at` int(11) NOT NULL,
        PRIMARY KEY (`id`),
        FOREIGN KEY ( `created_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `updated_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT
        )
       ");

        DB::statement("
         CREATE TABLE `property_place_working_hour` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
        `language_key` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
        `status` tinyint(3) unsigned NOT NULL DEFAULT '1',
        `created_by` int(10) unsigned NOT NULL,
        `updated_by` int(10) unsigned NOT NULL,
        `created_at` int(11) NOT NULL,
        `updated_at` int(11) NOT NULL,
        PRIMARY KEY (`id`),
        FOREIGN KEY ( `created_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `updated_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT
        )
       ");

        DB::statement("
         CREATE TABLE `property_place` (
        `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
        `property_id` int(10) unsigned NOT NULL,
        `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
        `place_category_id` int(10) unsigned NOT NULL,
        `place_working_hour_id` int(10) unsigned NOT NULL,
        `reservation_requirement` tinyint(3) NOT NULL,
        `status` tinyint(3) unsigned NOT NULL DEFAULT '1',
        `created_by` int(10) unsigned NOT NULL,
        `updated_by` int(10) unsigned NOT NULL,
        `created_at` int(11) NOT NULL,
        `updated_at` int(11) NOT NULL,
        PRIMARY KEY (`id`),
        FOREIGN KEY ( `property_id` ) REFERENCES `property` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `place_category_id` ) REFERENCES `property_place_category` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `place_working_hour_id` ) REFERENCES `property_place_working_hour` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `created_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT,
        FOREIGN KEY ( `updated_by` ) REFERENCES `user` ( `id` ) ON DELETE RESTRICT ON UPDATE RESTRICT
        )
       ");

        DB::statement("ALTER TABLE `property_place` ADD UNIQUE `unique_index`(`property_id`, `place_category_id`);");


        DB::statement("INSERT INTO `property_place_working_hour` VALUES
            (1,'All day', NULL, 1,1,1,1,1),
            (2,'Certain Days',NULL, 1,1,1,1,1),
            (3,'Weekdays', NULL, 1,1,1,1,1),
            (4,'Weekend', NULL, 1,1,1,1,1)
            ;");

        // LEVEL 1
        DB::statement("INSERT INTO `property_place_category` VALUES
            (1,'FOOD & BEVERAGE', NULL, NULL, 1, 0, NULL, 1,1,1,1,1),
            (2,'POOL, BEACH, AQUAPARK', NULL, NULL, 1, 0, NULL, 1,1,1,1,1),
            (3,'SPA & WELLNESS & FITNESS', NULL, NULL, 1, 0, NULL, 1,1,1,1,1),
            (4,'MEETING & EVENTS', NULL, NULL, 1, 0, NULL, 1,1,1,1,1),
            (5,'ACTIVITIES', NULL, NULL, 1, 0, NULL, 1,1,1,1,1),
            (6,'KIDS', NULL, NULL, 1, 0, NULL, 1,1,1,1,1)
            ;");

        // LEVEL 2
        DB::statement("INSERT INTO `property_place_category` VALUES
            (7,'Restaurant', NULL, 1, 2, 0, NULL, 1,1,1,1,1),
            (8,'Bar', NULL, 1, 2, 0, NULL, 1,1,1,1,1),
            (9,'Cafe', NULL, 1, 2, 0, NULL, 1,1,1,1,1),
            (10,'Patisserie', NULL, 1, 2, 0, NULL, 1,1,1,1,1),
            (11,'Pool', NULL, 2, 2, 0, NULL, 1,1,1,1,1),
            (12,'Beach', NULL, 2, 2, 0, NULL, 1,1,1,1,1),
            (13,'Aqua Park', NULL, 2, 2, 0, NULL, 1,1,1,1,1),
            (14,'Fitness Center', NULL, 3, 2, 0, NULL, 1,1,1,1,1),
            (15,'Spa', NULL, 3, 2, 0, NULL, 1,1,1,1,1),
            (16,'Meeting room', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (17,'Wedding Hall', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (18,'Fairground', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (19,'Theatre Hall', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (20,'Congress Center', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (21,'Open Air Stage', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (22,'Auditorium Hall', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (23,'Foyer Area', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (24,'Ballroom', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (25,'Concert Area', NULL, 4, 2, 0, NULL, 1,1,1,1,1),
            (26,'Casino', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (27,'Golf Course', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (28,'Tennis Court', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (29,'Volleyball Court', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (30,'Football Field', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (31,'Ski Piste', NULL, 5, 2, 0, NULL, 1,1,1,1,1),
            (32,'Theme Park', NULL, 6, 2, 0, NULL, 1,1,1,1,1),
            (33,'Zoo', NULL, 6, 2, 0, NULL, 1,1,1,1,1),
            (34,'Aquarium', NULL, 6, 2, 0, NULL, 1,1,1,1,1),
            (35,'Museum and Science Center', NULL, 6, 2, 0, NULL, 1,1,1,1,1)
            ;");

        // LEVEL 3
        DB::statement("INSERT INTO `property_place_category` VALUES
            (36,'Fast Food', NULL, 7, 3, 0, NULL, 1,1,1,1,1),
            (37,'Fast Casual', NULL, 7, 3, 0, NULL, 1,1,1,1,1),
            (38,'Casual Dining', NULL, 7, 3, 0, NULL, 1,1,1,1,1),
            (39,'Fine Dining', NULL, 7, 3, 0, NULL, 1,1,1,1,1),
            (40,'Family Style', NULL, 7, 3, 0, NULL, 1,1,1,1,1),
            (41,'Garden Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (42,'Konsept Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (43,'Lobi Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (44,'Snack Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (45,'Sports Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (46,'İskele Barı', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (47,'Vitamin Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (48,'Disco Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (49,'Bowling Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (50,'Havuz Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (51,'Plaj Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (52,'Teras Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (53,'Kafe Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (54,'Dispence Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (55,'Kokteyl Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (56,'Piyano Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (57,'Pub Bar', NULL, 8, 3, 0, NULL, 1,1,1,1,1),
            (58,'Bistro', NULL, 9, 3, 0, NULL, 1,1,1,1,1),
            (59,'Brasserie', NULL, 9, 3, 0, NULL, 1,1,1,1,1),
            (60,'Nargile Cafe', NULL, 9, 3, 0, NULL, 1,1,1,1,1),
            (61,'Çocuk Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (62,'Yüzme Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (63,'Thermal Havuz', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (64,'Dalga Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (65,'Dalma Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (66,'Tur Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (67,'Temalı Havuz', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (68,'Yer Üstü Havuz', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (69,'Şişme Havuz', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (70,'Sonsuzluk Havuzu', NULL, 11, 3, 0, NULL, 1,1,1,1,1),
            (71,'Kum', NULL, 12, 3, 0, NULL, 1,1,1,1,1),
            (72,'Çakıl', NULL, 12, 3, 0, NULL, 1,1,1,1,1),
            (73,'Kum çakıl karışık', NULL, 12, 3, 0, NULL, 1,1,1,1,1),
            (74,'Beyaz Kum', NULL, 12, 3, 0, NULL, 1,1,1,1,1),
            (75,'İskele', NULL, 12, 3, 0, NULL, 1,1,1,1,1),
            (76,'Aerobic Centers', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (77,'Yoga Centers', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (78,'Dance Centers', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (79,'Pilates Centers', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (80,'Gyms', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (81,'Athletic Clubs', NULL, 14, 3, 0, NULL, 1,1,1,1,1),
            (82,'Wellness Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (83,'Bootcamp Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (84,'Club Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (85,'Day Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (86,'Dental Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (87,'Destination Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (88,'Hammam Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (89,'Health Farms/Health Spas', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (90,'Health Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (91,'Medical Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (92,'Mobile Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (93,'Relaxation Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (94,'Spa Resort', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (95,'Thermal Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (96,'Wellness Spa', NULL, 15, 3, 0, NULL, 1,1,1,1,1),
            (97,'Theatre/Auditorium Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (98,'U-shape Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (99,'Banquet Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (100,'Reception Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (101,'Cabaret-Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (102,'Conference/Boardroom Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (103,'Classroom Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (104,'Herringbone Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (105,'Fishbowl Style', NULL, 16, 3, 0, NULL, 1,1,1,1,1),
            (106,'House of Worship', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (107,'Banquet Hall', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (108,'Country Club', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (109,'Farm or Barn', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (110,'Historic Home', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (111,'Museum', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (112,'Theater', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (113,'Restaurant', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (114,'Vineyard or Winery', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (115,'Modern Space or Loft', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (116,'Beach', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (117,'Boat', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (118,'Garden', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (119,'Pool', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (120,'Mansion', NULL, 17, 3, 0, NULL, 1,1,1,1,1),
            (121,'Links Courses', NULL, 27, 3, 0, NULL, 1,1,1,1,1),
            (122,'Parkland Courses', NULL, 27, 3, 0, NULL, 1,1,1,1,1),
            (123,'Desert Courses', NULL, 27, 3, 0, NULL, 1,1,1,1,1),
            (124,'Sand Courses', NULL, 27, 3, 0, NULL, 1,1,1,1,1),
            (125,'Clay', NULL, 28, 3, 0, NULL, 1,1,1,1,1),
            (126,'Grass', NULL, 28, 3, 0, NULL, 1,1,1,1,1),
            (127,'Hard Courts', NULL, 28, 3, 0, NULL, 1,1,1,1,1),
            (128,'Carpet', NULL, 28, 3, 0, NULL, 1,1,1,1,1),
            (129,'Indoor Volleyball', NULL, 29, 3, 0, NULL, 1,1,1,1,1),
            (130,'Outdoor Volleyball', NULL, 29, 3, 0, NULL, 1,1,1,1,1),
            (131,'Beach Volleyball', NULL, 29, 3, 0, NULL, 1,1,1,1,1),
            (132,'Doğal Çim', NULL, 30, 3, 0, NULL, 1,1,1,1,1),
            (133,'Suni Çim', NULL, 30, 3, 0, NULL, 1,1,1,1,1),
            (134,'Akrilik', NULL, 30, 3, 0, NULL, 1,1,1,1,1),
            (135,'EPDM', NULL, 30, 3, 0, NULL, 1,1,1,1,1),
            (136,'Snow Cooling', NULL, 31, 3, 0, NULL, 1,1,1,1,1),
            (137,'Ski Jump Cooling', NULL, 31, 3, 0, NULL, 1,1,1,1,1),
            (138,'Snow Cooling Children’s Ski Slope', NULL, 31, 3, 0, NULL, 1,1,1,1,1),
            (139,'Water', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (140,'Zoological', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (141,'Historical', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (142,'Regional', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (143,'Pop Culture', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (144,'Eco', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (145,'Fun Fair', NULL, 32, 3, 0, NULL, 1,1,1,1,1),
            (146,'Archaeology', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (147,'Art', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (148,'Encyclopedic', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (149,'History', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (150,'Maritime', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (151,'Military and War', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (152,'Mobile', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (153,'Natural', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (154,'Open-air', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (155,'Pop-up', NULL, 35, 3, 0, NULL, 1,1,1,1,1),
            (156,'Science and Technology', NULL, 35, 3, 0, NULL, 1,1,1,1,1)
            ;");

        DB::statement("INSERT INTO `property_place_category` VALUES
            (157,'Botanic Garden', NULL, 6, 2, 0, NULL, 1,1,1,1,1)
            ;");

    }


    public function down()
    {

    }
}
