<?php
abstract class SBPAI_Module_Base {
    protected $faker;
    protected $args;

    public function __construct( $args = array() ) {
        $this->faker = Faker\Factory::create();
        $this->args = $args;
    }

    abstract public function generate();

    protected function track_dummy( $id, $type = 'post' ) {
        if ( $type === 'post' ) {
            update_post_meta( $id, '_sbpai_post', '1' );
        } elseif ( $type === 'user' ) {
            update_user_meta( $id, '_sbpai_user', '1' );
        } elseif ( $type === 'order' ) {
            // Use WC order meta (HPOS-compatible) instead of raw postmeta
            $order = wc_get_order( $id );
            if ( $order ) {
                $order->update_meta_data( '_sbpai_order', '1' );
                $order->save_meta_data();
            }
        } elseif ( $type === 'product' ) {
            update_post_meta( $id, '_sbpai_product', '1' );
        }
    }
}
