<?php

/**
 * Fired during plugin activation
 *
 * @link       https://yourwebsite.com
 * @since      1.0.0
 *
 * @package    CSPG_Basic_SEO_Helper
 * @subpackage CSPG_Basic_SEO_Helper/includes
 */

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Fired during plugin activation.
 *
 * This class defines all code necessary to run during the plugin's activation.
 *
 * @since      1.0.0
 * @package    CSPG_Basic_SEO_Helper
 * @subpackage CSPG_Basic_SEO_Helper/includes
 * @author     CSP Geeks LLC <info@cspgeeks.com>
 */
class CSPG_Basic_SEO_Helper_Activator {

	/**
	 * Short Description. (use period)
	 *
	 * Long Description.
	 *
	 * @since    1.0.0
	 */
	public static function activate() {
		// Create default options
		$default_options = array(
			'facebook_app_id'   => '',
			'twitter_username'  => '',
			'default_image'     => '',
			'author_name'       => '',
			'author_url'        => '',
			'organization_name' => get_bloginfo( 'name' ),
			'organization_logo' => '',
			'social_profiles'   => array(),
		);

		add_option( 'cspgbase_options', $default_options );

		// Create default template options
		$template_defaults = array(
			'cspgbase_default_title_template'          => '{post_title} {separator} {site_name}',
			'cspgbase_default_description_template'    => '{excerpt}',
			'cspgbase_default_og_title_template'       => '{post_title}',
			'cspgbase_default_og_description_template' => '{excerpt}',
			'cspgbase_fallback_text'                   => 'Visit {site_name} for the latest updates.',
			'cspgbase_title_separator'                 => '|',
		);

		// Add template options if they don't exist
		foreach ( $template_defaults as $option_name => $default_value ) {
			add_option( $option_name, $default_value );
		}

		// Flush rewrite rules if needed
		flush_rewrite_rules();
	}
}
