<?php

/*
Plugin Name:          Chit - Download codes for WooCommerce
Plugin URI:           https://inneoin.com/chit.html
Description:          Generate redemption codes for physical sales that unlock WooCommerce digital downloads.
Version:              1.2
Author:               Jack Gleeson
License:              GPLv2 or later
License URI:          https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:          chit-download-codes-for-woocommerce
Domain Path:          /languages
Requires at least:    6.4
Tested up to:         7.0
Requires PHP:         7.4
Requires Plugins:     woocommerce
WC requires at least: 5.0
WC tested up to:      8.0
*/
/*
Copyright (C) 2026 Jack Gleeson

Chit is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

Chit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Chit. If not, see <https://www.gnu.org/licenses/>.
*/
defined( "ABSPATH" ) || exit;
if ( function_exists( "chit_fs" ) ) {
    // Free version coexists with the Pro version during an upgrade — the
    // Pro version already defined chit_fs(), so signal the free build's
    // basename so Freemius can auto-deactivate it.
    chit_fs()->set_basename( false, __FILE__ );
} else {
    define( "CHIT_VERSION", "1.2" );
    define( "CHIT_FILE", __FILE__ );
    define( "CHIT_PATH", plugin_dir_path( __FILE__ ) );
    define( "CHIT_URL", plugin_dir_url( __FILE__ ) );
    if ( !function_exists( "chit_fs" ) ) {
        function chit_fs() {
            global $chit_fs;
            if ( !isset( $chit_fs ) ) {
                require_once CHIT_PATH . "vendor/freemius/start.php";
                $chit_fs = fs_dynamic_init( [
                    "id"               => "30165",
                    "slug"             => "chit",
                    "type"             => "plugin",
                    "public_key"       => "pk_3fea4131a95e07a27fdc1a9b64270",
                    "is_premium"       => false,
                    "premium_suffix"   => "Pro",
                    "has_addons"       => false,
                    "has_paid_plans"   => true,
                    "is_org_compliant" => true,
                    "menu"             => [
                        "slug"       => "chit",
                        "first-path" => "admin.php?page=chit",
                        "support"    => false,
                    ],
                    'is_live'          => true,
                ] );
            }
            return $chit_fs;
        }

        chit_fs();
        do_action( "chit_fs_loaded" );
    }
    require_once CHIT_PATH . "includes/class-chit-plugin.php";
    Chit_Plugin::instance()->init();
}