CREATE TABLE SensitiveWord (
    id VARCHAR(191) NOT NULL, word VARCHAR(100) NOT NULL,
    category VARCHAR(32) NOT NULL DEFAULT 'general', riskLevel VARCHAR(16) NOT NULL DEFAULT 'medium',
    enabled BOOLEAN NOT NULL DEFAULT true, createdAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    updatedAt DATETIME(3) NOT NULL,
    UNIQUE INDEX SensitiveWord_word_key(word), INDEX SensitiveWord_category_idx(category),
    PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE TABLE ContentSafetyCheck (
    id VARCHAR(191) NOT NULL, userId VARCHAR(100), contentType VARCHAR(32) NOT NULL,
    content TEXT NOT NULL, riskLevel VARCHAR(16) NOT NULL, matchedWords TEXT,
    result VARCHAR(16) NOT NULL DEFAULT 'pending', reviewerId VARCHAR(100),
    reviewNote VARCHAR(500), createdAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    reviewedAt DATETIME(3),
    INDEX ContentSafetyCheck_userId_idx(userId), INDEX ContentSafetyCheck_result_idx(result),
    INDEX ContentSafetyCheck_createdAt_idx(createdAt), PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

CREATE TABLE ContentReport (
    id VARCHAR(191) NOT NULL, reporterId VARCHAR(191) NOT NULL,
    targetType VARCHAR(32) NOT NULL, targetId VARCHAR(100) NOT NULL,
    reason VARCHAR(500) NOT NULL, status VARCHAR(16) NOT NULL DEFAULT 'pending',
    handledBy VARCHAR(100), handleNote VARCHAR(500),
    createdAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), handledAt DATETIME(3),
    INDEX ContentReport_status_idx(status), INDEX ContentReport_createdAt_idx(createdAt),
    PRIMARY KEY (id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
