package com.bytedance.sync.v2.presistence;

import X.0BT;
import X.0BV;
import X.0BW;
import X.0BY;
import X.0Fe;
import X.0Fk;
import X.0Fo;
import X.0Fw;
import X.0G9;
import X.1DC;
import X.C1412Rhg;
import X.C1416Rhk;
import X.C1418Rhm;
import X.C1426Rhu;
import X.C1427Rhv;
import X.C1428Rhw;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.HashMap;
import java.util.HashSet;

public class AppDatabase_Impl extends AppDatabase {
    public volatile C1418Rhm LJIIJ;
    public volatile C1412Rhg LJIIJJI;
    public volatile C1416Rhk LJIIL;

    static {
        Covode.recordClassIndex(38341);
    }

    public final 0Fw LIZ() {
        return new 0Fw(this, new String[]{"t_business", "t_report_synclog", "t_sync_cursor", "t_synclog", "t_snapshot"});
    }

    public final C1418Rhm LJIIIIZZ() {
        C1418Rhm rhm;
        MethodCollector.i(1143);
        if (this.LJIIJ != null) {
            C1418Rhm rhm2 = this.LJIIJ;
            MethodCollector.o(1143);
            return rhm2;
        }
        synchronized (this) {
            try {
                if (this.LJIIJ == null) {
                    this.LJIIJ = new C1427Rhv(this);
                }
                rhm = this.LJIIJ;
            } finally {
                MethodCollector.o(1143);
            }
        }
        return rhm;
    }

    public final C1412Rhg LJIIIZ() {
        C1412Rhg rhg;
        MethodCollector.i(1146);
        if (this.LJIIJJI != null) {
            C1412Rhg rhg2 = this.LJIIJJI;
            MethodCollector.o(1146);
            return rhg2;
        }
        synchronized (this) {
            try {
                if (this.LJIIJJI == null) {
                    this.LJIIJJI = new C1426Rhu(this);
                }
                rhg = this.LJIIJJI;
            } finally {
                MethodCollector.o(1146);
            }
        }
        return rhg;
    }

    public final C1416Rhk LJIIJ() {
        C1416Rhk rhk;
        MethodCollector.i(1206);
        if (this.LJIIL != null) {
            C1416Rhk rhk2 = this.LJIIL;
            MethodCollector.o(1206);
            return rhk2;
        }
        synchronized (this) {
            try {
                if (this.LJIIL == null) {
                    this.LJIIL = new C1428Rhw(this);
                }
                rhk = this.LJIIL;
            } finally {
                MethodCollector.o(1206);
            }
        }
        return rhk;
    }

    public final 0BY LIZIZ(0Fe r5) {
        1DC r3 = new 1DC(r5, new 0G9() {
            static {
                Covode.recordClassIndex(38342);
            }

            public final void LIZ() {
                if (AppDatabase_Impl.this.LJI != null) {
                    int size = AppDatabase_Impl.this.LJI.size();
                    for (int i = 0; i < size; i++) {
                        AppDatabase_Impl.this.LJI.get(i);
                    }
                }
            }

            public final void LIZ(0BT r2) {
                r2.LIZJ("DROP TABLE IF EXISTS `t_business`");
                r2.LIZJ("DROP TABLE IF EXISTS `t_report_synclog`");
                r2.LIZJ("DROP TABLE IF EXISTS `t_sync_cursor`");
                r2.LIZJ("DROP TABLE IF EXISTS `t_synclog`");
                r2.LIZJ("DROP TABLE IF EXISTS `t_snapshot`");
            }

            public final void LIZIZ(0BT r2) {
                r2.LIZJ("CREATE TABLE IF NOT EXISTS `t_business` (`id` INTEGER NOT NULL, `consume_type` INTEGER, `bucket` INTEGER, PRIMARY KEY(`id`))");
                r2.LIZJ("CREATE TABLE IF NOT EXISTS `t_report_synclog` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `sync_id` TEXT, `business` INTEGER NOT NULL, `did` TEXT, `uid` TEXT, `bucket` INTEGER, `cursor` INTEGER NOT NULL, `data` BLOB, `md5` TEXT)");
                r2.LIZJ("CREATE TABLE IF NOT EXISTS `t_sync_cursor` (`sync_id` TEXT NOT NULL, `did` TEXT, `uid` TEXT, `topic_type` INTEGER, `bucket` INTEGER, `recv_cursor` INTEGER NOT NULL, `report_cursor` INTEGER NOT NULL, PRIMARY KEY(`sync_id`))");
                r2.LIZJ("CREATE TABLE IF NOT EXISTS `t_synclog` (`sync_id` TEXT NOT NULL, `did` TEXT, `uid` TEXT, `sync_cursor` INTEGER NOT NULL, `data` BLOB, `md5` TEXT, `business` INTEGER NOT NULL, `consume_type` INTEGER, `data_type` INTEGER, `publish_ts` INTEGER NOT NULL, `receive_ts` INTEGER NOT NULL, `bucket` INTEGER, `req_id` TEXT, PRIMARY KEY(`sync_id`, `sync_cursor`))");
                r2.LIZJ("CREATE TABLE IF NOT EXISTS `t_snapshot` (`sync_id` TEXT NOT NULL, `business` INTEGER NOT NULL, `uid` TEXT, `did` TEXT, `cursor` INTEGER NOT NULL, `data` BLOB, `notified` INTEGER NOT NULL, `bucket` INTEGER, `data_type` INTEGER, `publish_ts` INTEGER NOT NULL, `receive_ts` INTEGER NOT NULL, `consume_type` INTEGER, `patch_cnt` INTEGER NOT NULL, PRIMARY KEY(`sync_id`, `business`))");
                r2.LIZJ("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)");
                r2.LIZJ("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"176b0459a5a82eb6a61d248ab647643b\")");
            }

            public final void LIZJ(0BT r4) {
                AppDatabase_Impl.this.LIZ = r4;
                AppDatabase_Impl.this.LIZ(r4);
                if (AppDatabase_Impl.this.LJI != null) {
                    int size = AppDatabase_Impl.this.LJI.size();
                    for (int i = 0; i < size; i++) {
                        AppDatabase_Impl.this.LJI.get(i);
                    }
                }
            }

            public final void LIZLLL(0BT r27) {
                HashMap hashMap = new HashMap(3);
                hashMap.put("id", new 0Fk("id", "INTEGER", true, 1));
                hashMap.put("consume_type", new 0Fk("consume_type", "INTEGER", false, 0));
                hashMap.put("bucket", new 0Fk("bucket", "INTEGER", false, 0));
                0Fo r5 = new 0Fo("t_business", hashMap, new HashSet(0), new HashSet(0));
                0BT r15 = r27;
                0Fo LIZ = 0Fo.LIZ(r15, "t_business");
                if (r5.equals(LIZ)) {
                    HashMap hashMap2 = new HashMap(9);
                    hashMap2.put("id", new 0Fk("id", "INTEGER", true, 1));
                    hashMap2.put("sync_id", new 0Fk("sync_id", "TEXT", false, 0));
                    hashMap2.put("business", new 0Fk("business", "INTEGER", true, 0));
                    hashMap2.put("did", new 0Fk("did", "TEXT", false, 0));
                    hashMap2.put("uid", new 0Fk("uid", "TEXT", false, 0));
                    hashMap2.put("bucket", new 0Fk("bucket", "INTEGER", false, 0));
                    hashMap2.put("cursor", new 0Fk("cursor", "INTEGER", true, 0));
                    hashMap2.put("data", new 0Fk("data", "BLOB", false, 0));
                    hashMap2.put("md5", new 0Fk("md5", "TEXT", false, 0));
                    0Fo r4 = new 0Fo("t_report_synclog", hashMap2, new HashSet(0), new HashSet(0));
                    0Fo LIZ2 = 0Fo.LIZ(r15, "t_report_synclog");
                    if (r4.equals(LIZ2)) {
                        HashMap hashMap3 = new HashMap(7);
                        hashMap3.put("sync_id", new 0Fk("sync_id", "TEXT", true, 1));
                        hashMap3.put("did", new 0Fk("did", "TEXT", false, 0));
                        hashMap3.put("uid", new 0Fk("uid", "TEXT", false, 0));
                        hashMap3.put("topic_type", new 0Fk("topic_type", "INTEGER", false, 0));
                        hashMap3.put("bucket", new 0Fk("bucket", "INTEGER", false, 0));
                        hashMap3.put("recv_cursor", new 0Fk("recv_cursor", "INTEGER", true, 0));
                        hashMap3.put("report_cursor", new 0Fk("report_cursor", "INTEGER", true, 0));
                        0Fo r42 = new 0Fo("t_sync_cursor", hashMap3, new HashSet(0), new HashSet(0));
                        0Fo LIZ3 = 0Fo.LIZ(r15, "t_sync_cursor");
                        if (r42.equals(LIZ3)) {
                            HashMap hashMap4 = new HashMap(13);
                            hashMap4.put("sync_id", new 0Fk("sync_id", "TEXT", true, 1));
                            hashMap4.put("did", new 0Fk("did", "TEXT", false, 0));
                            hashMap4.put("uid", new 0Fk("uid", "TEXT", false, 0));
                            hashMap4.put("sync_cursor", new 0Fk("sync_cursor", "INTEGER", true, 2));
                            hashMap4.put("data", new 0Fk("data", "BLOB", false, 0));
                            hashMap4.put("md5", new 0Fk("md5", "TEXT", false, 0));
                            hashMap4.put("business", new 0Fk("business", "INTEGER", true, 0));
                            hashMap4.put("consume_type", new 0Fk("consume_type", "INTEGER", false, 0));
                            hashMap4.put("data_type", new 0Fk("data_type", "INTEGER", false, 0));
                            hashMap4.put("publish_ts", new 0Fk("publish_ts", "INTEGER", true, 0));
                            hashMap4.put("receive_ts", new 0Fk("receive_ts", "INTEGER", true, 0));
                            hashMap4.put("bucket", new 0Fk("bucket", "INTEGER", false, 0));
                            hashMap4.put("req_id", new 0Fk("req_id", "TEXT", false, 0));
                            0Fo r21 = new 0Fo("t_synclog", hashMap4, new HashSet(0), new HashSet(0));
                            0Fo LIZ4 = 0Fo.LIZ(r15, "t_synclog");
                            if (r21.equals(LIZ4)) {
                                HashMap hashMap5 = new HashMap(13);
                                hashMap5.put("sync_id", new 0Fk("sync_id", "TEXT", true, 1));
                                hashMap5.put("business", new 0Fk("business", "INTEGER", true, 2));
                                hashMap5.put("uid", new 0Fk("uid", "TEXT", false, 0));
                                hashMap5.put("did", new 0Fk("did", "TEXT", false, 0));
                                hashMap5.put("cursor", new 0Fk("cursor", "INTEGER", true, 0));
                                hashMap5.put("data", new 0Fk("data", "BLOB", false, 0));
                                hashMap5.put("notified", new 0Fk("notified", "INTEGER", true, 0));
                                hashMap5.put("bucket", new 0Fk("bucket", "INTEGER", false, 0));
                                hashMap5.put("data_type", new 0Fk("data_type", "INTEGER", false, 0));
                                hashMap5.put("publish_ts", new 0Fk("publish_ts", "INTEGER", true, 0));
                                hashMap5.put("receive_ts", new 0Fk("receive_ts", "INTEGER", true, 0));
                                hashMap5.put("consume_type", new 0Fk("consume_type", "INTEGER", false, 0));
                                hashMap5.put("patch_cnt", new 0Fk("patch_cnt", "INTEGER", true, 0));
                                0Fo r43 = new 0Fo("t_snapshot", hashMap5, new HashSet(0), new HashSet(0));
                                0Fo LIZ5 = 0Fo.LIZ(r15, "t_snapshot");
                                if (!r43.equals(LIZ5)) {
                                    throw new IllegalStateException("Migration didn't properly handle t_snapshot(com.bytedance.sync.v2.presistence.table.Snapshot).\n Expected:\n" + r43 + "\n Found:\n" + LIZ5);
                                }
                                return;
                            }
                            throw new IllegalStateException("Migration didn't properly handle t_synclog(com.bytedance.sync.v2.presistence.table.SyncLog).\n Expected:\n" + r21 + "\n Found:\n" + LIZ4);
                        }
                        throw new IllegalStateException("Migration didn't properly handle t_sync_cursor(com.bytedance.sync.v2.presistence.table.SyncCursor).\n Expected:\n" + r42 + "\n Found:\n" + LIZ3);
                    }
                    throw new IllegalStateException("Migration didn't properly handle t_report_synclog(com.bytedance.sync.v2.presistence.table.UploadItem).\n Expected:\n" + r4 + "\n Found:\n" + LIZ2);
                }
                throw new IllegalStateException("Migration didn't properly handle t_business(com.bytedance.sync.v2.presistence.table.Business).\n Expected:\n" + r5 + "\n Found:\n" + LIZ);
            }
        }, "176b0459a5a82eb6a61d248ab647643b", "10d31738071062c01fb018398dd98f36");
        0BV LIZ = 0BW.LIZ(r5.LIZIZ);
        LIZ.LIZIZ = r5.LIZJ;
        LIZ.LIZJ = r3;
        return r5.LIZ.LIZ(LIZ.LIZ());
    }
}
