<?php

namespace MovieEngine\PostTypes;

if (! defined("ABSPATH")) {
    exit; // Exit if accessed directly
}

class Season {

    public function __construct() {
        add_action('init', [$this, 'register']);
    }

    public function register() {
        $labels = [
            'name'               => esc_html_x('Seasons', 'post type general name', 'cine-movie-engine'),
            'singular_name'      => esc_html_x('Season', 'post type singular name', 'cine-movie-engine'),
            'menu_name'          => esc_html_x('Seasons', 'admin menu', 'cine-movie-engine'),
            'name_admin_bar'     => esc_html_x('Season', 'add new on admin bar', 'cine-movie-engine'),
            'add_new'            => esc_html_x('Add New', 'season', 'cine-movie-engine'),
            'add_new_item'       => esc_html__('Add New Season', 'cine-movie-engine'),
            'new_item'           => esc_html__('New Season', 'cine-movie-engine'),
            'edit_item'          => esc_html__('Edit Season', 'cine-movie-engine'),
            'view_item'          => esc_html__('View Season', 'cine-movie-engine'),
            'all_items'          => esc_html__('All Seasons', 'cine-movie-engine'),
            'search_items'       => esc_html__('Search Seasons', 'cine-movie-engine'),
            'parent_item_colon'  => esc_html__('Parent Season:', 'cine-movie-engine'),
            'not_found'          => esc_html__('No seasons found.', 'cine-movie-engine'),
            'not_found_in_trash' => esc_html__('No seasons found in Trash.', 'cine-movie-engine'),
        ];

        $args = [
            'labels'             => $labels,
            'public'             => true,
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => 'edit.php?post_type=movie_engine_series',
            'query_var'          => true,
            'rewrite'            => ['slug' => 'season'],
            'capability_type'    => 'post',
            'has_archive'        => false,
            'hierarchical'       => true,
            'menu_position'      => null,
            'menu_icon'          => 'dashicons-playlist-video',
            'supports'           => ['title', 'editor', 'thumbnail', 'excerpt', 'page-attributes'],
            'show_in_rest'       => true,
        ];

        register_post_type('movie_engine_season', $args);
    }
}
