<?php
function bilal_portfolio_enqueue_assets() {
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_uri(), array('parent-style'));
    wp_enqueue_script('bilal-scripts', get_stylesheet_directory_uri() . '/js/scripts.js', array(), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'bilal_portfolio_enqueue_assets');

// Register Projects Custom Post Type
function bilal_portfolio_register_projects_cpt() {
    $labels = array(
        'name'                  => _x( 'Projects', 'Post Type General Name', 'bilal-portfolio' ),
        'singular_name'         => _x( 'Project', 'Post Type Singular Name', 'bilal-portfolio' ),
        'menu_name'             => __( 'Projects', 'bilal-portfolio' ),
        'name_admin_bar'        => __( 'Project', 'bilal-portfolio' ),
        'archives'              => __( 'Project Archives', 'bilal-portfolio' ),
        'attributes'            => __( 'Project Attributes', 'bilal-portfolio' ),
        'parent_item_colon'     => __( 'Parent Project:', 'bilal-portfolio' ),
        'all_items'             => __( 'All Projects', 'bilal-portfolio' ),
        'add_new_item'          => __( 'Add New Project', 'bilal-portfolio' ),
        'add_new'               => __( 'Add New', 'bilal-portfolio' ),
        'new_item'              => __( 'New Project', 'bilal-portfolio' ),
        'edit_item'             => __( 'Edit Project', 'bilal-portfolio' ),
        'update_item'           => __( 'Update Project', 'bilal-portfolio' ),
        'view_item'             => __( 'View Project', 'bilal-portfolio' ),
        'view_items'            => __( 'View Projects', 'bilal-portfolio' ),
        'search_items'          => __( 'Search Project', 'bilal-portfolio' ),
        'not_found'             => __( 'Not found', 'bilal-portfolio' ),
        'not_found_in_trash'    => __( 'Not found in Trash', 'bilal-portfolio' ),
        'featured_image'        => __( 'Project Image', 'bilal-portfolio' ),
        'set_featured_image'    => __( 'Set project image', 'bilal-portfolio' ),
        'remove_featured_image' => __( 'Remove project image', 'bilal-portfolio' ),
        'use_featured_image'    => __( 'Use as project image', 'bilal-portfolio' ),
        'insert_into_item'      => __( 'Insert into project', 'bilal-portfolio' ),
        'uploaded_to_this_item' => __( 'Uploaded to this project', 'bilal-portfolio' ),
        'items_list'            => __( 'Projects list', 'bilal-portfolio' ),
        'items_list_navigation' => __( 'Projects list navigation', 'bilal-portfolio' ),
        'filter_items_list'     => __( 'Filter projects list', 'bilal-portfolio' ),
    );
    $args = array(
        'label'                 => __( 'Project', 'bilal-portfolio' ),
        'description'           => __( 'Bilal\'s Portfolio Projects', 'bilal-portfolio' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
        'taxonomies'            => array( 'category', 'post_tag' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-portfolio',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
        'show_in_rest'          => true, // Enable Gutenberg for this CPT
    );
    register_post_type( 'portfolio_project', $args );
}
add_action( 'init', 'bilal_portfolio_register_projects_cpt', 0 );
