<?php
class Whizzie {

    public function __construct() {
        $this->init();
    }

    public function init() {
        $this->beauty_cosmetic_shop_setup_theme_mods();
    }

    public function beauty_cosmetic_shop_setup_theme_mods() {
        $beauty_cosmetic_shop_options = get_theme_mod('theme_options', []);
        $beauty_cosmetic_shop_options['header_top_button'] = 'Appointment';
        $beauty_cosmetic_shop_options['header_top_buttonlink'] = '#';
        set_theme_mod('theme_options', $beauty_cosmetic_shop_options);

        /* Create Menu */
            $beauty_cosmetic_shop_menuname  = 'Primary Menu';
            $beauty_cosmetic_shop_location  = 'primary-menu';

            $beauty_cosmetic_shop_menu = wp_get_nav_menu_object( $beauty_cosmetic_shop_menuname );

            if ( ! $beauty_cosmetic_shop_menu ) {
            $beauty_cosmetic_shop_menu_id = wp_create_nav_menu( $beauty_cosmetic_shop_menuname );

           // Home Page 
			wp_update_nav_menu_item( $beauty_cosmetic_shop_menu_id, 0, array(
				'menu-item-title'     => __( 'Home', 'beauty-cosmetic-shop' ),
				'menu-item-url'       => home_url( '/' ),
				'menu-item-type'      => 'custom',
				'menu-item-status'    => 'publish',
			) );

			// About Us Page 
			$beauty_cosmetic_shop_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'About Us',
			'post_status' => 'publish',
			) );
 
			if ( $beauty_cosmetic_shop_about_id ) {
			wp_update_nav_menu_item( $beauty_cosmetic_shop_menu_id, 0, array(
			'menu-item-title'     => 'About Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $beauty_cosmetic_shop_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

			// Pages Page 
			$beauty_cosmetic_shop_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Pages',
			'post_status' => 'publish',
			) );

			if ( $beauty_cosmetic_shop_about_id ) {
			wp_update_nav_menu_item( $beauty_cosmetic_shop_menu_id, 0, array(
			'menu-item-title'     => 'Pages',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $beauty_cosmetic_shop_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

			// Services Page 
			$beauty_cosmetic_shop_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Services',
			'post_status' => 'publish',
			) );

			if ( $beauty_cosmetic_shop_about_id ) {
			wp_update_nav_menu_item( $beauty_cosmetic_shop_menu_id, 0, array(
			'menu-item-title'     => 'Services',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $beauty_cosmetic_shop_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

			// Contact Us Page 
			$beauty_cosmetic_shop_about_id = wp_insert_post( array(
			'post_type'   => 'page',
			'post_content' => 'We are committed to providing reliable, professional, and result-oriented solutions tailored to meet individual needs. Our goal is to empower people with the right guidance, knowledge, and support to help them make informed decisions for a better future. <br><br> Our mission is to deliver high-quality services with honesty, transparency, and dedication. We focus on understanding client requirements and offering practical solutions that create long-term value. <br><br> With a client-centric approach, experienced professionals, and a commitment to excellence, we ensure every individual receives the attention and guidance they deserve. We believe in building trust through quality service and consistent results.',
			'post_title'  => 'Contact Us',
			'post_status' => 'publish',
			) );

			if ( $beauty_cosmetic_shop_about_id ) {
			wp_update_nav_menu_item( $beauty_cosmetic_shop_menu_id, 0, array(
			'menu-item-title'     => 'Contact Us',
			'menu-item-object'    => 'page',
			'menu-item-object-id' => $beauty_cosmetic_shop_about_id,
			'menu-item-type'      => 'post_type',
			'menu-item-status'    => 'publish',
			) );
			}

             // Create Shop Page
                $beauty_cosmetic_shop_about_title = 'Shop';
                $beauty_cosmetic_shop_about_content = 'Lorem ipsum dolor sit amet...';

                $shop_page = get_page_by_path('shop');
                if ( !$shop_page ) {
                    $beauty_cosmetic_shop_about = array(
                        'post_type'   => 'page',
                        'post_title'  => $beauty_cosmetic_shop_about_title,
                        'post_content'=> $beauty_cosmetic_shop_about_content,
                        'post_status' => 'publish',
                        'post_author' => 1,
                        'post_name'   => 'shop' 
                        );
                        $beauty_cosmetic_shop_about_id = wp_insert_post($beauty_cosmetic_shop_about);
                    } else {
                        $beauty_cosmetic_shop_about_id = $shop_page->ID;
                    }

                    wp_update_nav_menu_item($beauty_cosmetic_shop_menu_id, 0, array(
                        'menu-item-title'   => __('Shop', 'beauty-cosmetic-shop'),
                        'menu-item-classes' => 'shop',
                        'menu-item-object-id' => $beauty_cosmetic_shop_about_id,
                        'menu-item-object'  => 'page',
                        'menu-item-type'    => 'post_type',
                        'menu-item-status'  => 'publish'
                    ));
          
			/* Assign Menu Location */
			$beauty_cosmetic_shop_locations = get_theme_mod( 'nav_menu_locations', array() );
			$beauty_cosmetic_shop_locations[ $beauty_cosmetic_shop_location ] = $beauty_cosmetic_shop_menu_id;
			set_theme_mod( 'nav_menu_locations', $beauty_cosmetic_shop_locations );
		}
    }
}