from pypos.core.base_model import BaseModel
from pypos.core.utils.db_helper import connect_sqlite
from pypos.core.utils.path_utils import get_db_path


class SinkronPenjualanModel(BaseModel):
    def __init__(self):
        super().__init__()
        self.sqlite_conn = connect_sqlite(get_db_path())
        self.sqlite_conn.execute("PRAGMA foreign_keys = ON")

    def close_connections(self):
        if self.sqlite_conn:
            self.sqlite_conn.close()

    def sync_table(self, table_name, days=30):
        self.log_warning(f"sync_table dinonaktifkan untuk tabel: {table_name}")
        return 0

    def sync_table_last_update(self, table_name, key_column='id'):
        self.log_warning(f"sync_table_last_update dinonaktifkan untuk tabel: {table_name}")
        return 0