<?php
// Create a section.
CSF::createSection(
    $prefix,
    [
        'title'  => __( 'Voting', 'forumax' ),
		'icon'   => 'dashicons dashicons-thumbs-up',
        'fields' => [
            [
                'id'      => 'is_votes',
                'type'    => 'switcher',
                'default' => 1,
                'title'   => __( 'Enable BBP Voting Features?', 'forumax' ),
            ],

            [
                'id'          => 'vote_numbers_display',
                'type'        => 'select',
                'title'       => __( 'Display Vote Numbers', 'forumax' ),
                'sub'         => __( 'Choose how to display the number of up votes and down votes', 'forumax' ),
                'chosen'      => true,
                'placeholder' => __( 'Select an option', 'forumax' ),
                'options'     => [
                    'hover'       => __( 'Hover', 'forumax' ),
                    'always-show' => __( 'Always Show', 'forumax' ),
                    'hide'        => __( 'Hide', 'forumax' ),
                ],
                'default'     => 'hover',
				'dependency' => [ 'is_votes', '==', 'true' ]
            ],

            [
                'type'    => 'subheading',
                'content' => __( 'Voting Buttons', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_voting_disabled_topics',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Voting on Topics', 'forumax' ),
                'subtitle' => __( 'You can override this at the forum level', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_voting_disabled_replies',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Voting on Replies', 'forumax' ),
                'subtitle' => __( 'You can override this at the forum level', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_down_votes_disabled',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Down Votes', 'forumax' ),
                'subtitle' => __( 'Only Allow Up Votes', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'type'    => 'subheading',
                'content' => __( 'View-Only Scores', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_disabled_voting_for_non_logged_users',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Disable voting for visitors who are not logged in', 'forumax' ),
                'subtitle' => __( 'Scores will display (if configured to), but voting will be disabled if not logged in', 'forumax' ),
                'class'    => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_disabled_voting_closed_topics',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Disable adding new votes after a topic is closed', 'forumax' ),
                'subtitle' => __( 'Scores will display (if configured to), but new votes for the topic or the topic\'s replies will be disabled', 'forumax' ),
                'class'   => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_disabled_voting_own_topic_reply',
                'type'     => 'switcher',
                'default'  => 0,
                'title'    => __( 'Don\'t allow authors to vote on their own topic/reply', 'forumax' ),
                'subtitle' => __( 'They can still vote on other people\'s topics/replies', 'forumax' ),
                'class'   => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'type'    => 'subheading',
                'content' => __( 'Admin Voting', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'      => 'is_admin_can_vote_unlimited',
                'type'    => 'switcher',
                'default' => 0,
                'title'   => __( 'Allow any administrator user to vote as much as they want?', 'forumax' ),
                'class'   => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],
            
            [
                'type'    => 'subheading',
                'content' => __( 'Sort by Voting Scores', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_sort_topic_by_votes',
                'type'     => 'switcher',
                'default'  => false,
                'title'    => __( 'Sort topics in a forum using their voting scores?', 'forumax' ),
                'subtitle' => __( 'Highest voted topics on top', 'forumax' ),
                'class'    => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_sort_reply_by_votes',
                'type'     => 'switcher',
                'default'  => false,
                'title'    => __( 'Sort replies on a topic using their voting scores?', 'forumax' ),
                'subtitle' => __( 'Highest voted replies on top', 'forumax' ),
                'class'   => 'st-pro-notice',
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],

            [
                'id'       => 'is_lead_topic_broken',
                'type'     => 'switcher',
                'default'  => 1,
                'title'    => __( ' Break out the lead topic to separate it from the replies', 'forumax' ),
                'subtitle' => __( 'Simply enabled the built-in hook, bbp_show_lead_topic. This is useful to resolve a bug when sort order is messed up when Threaded Replies are enabled.', 'forumax' ),
				'dependency' => [ 'is_votes', '==', 'true', ]
            ],
        ],
    ]
);
