import mongoose from 'mongoose'

const wikiArticleSchema = new mongoose.Schema(
  {
    outlineId: { type: String, unique: true, required: true },
    title: { type: String, required: true },
    collection: String,
    url: { type: String, required: true },
    summary: String,
    tags: [{ type: String }],
    hidden: { type: Boolean, default: false },
    publishedAt: Date,
    permission: String,
    lastSyncedAt: Date,
    outlineUpdatedAt: Date
  },
  { timestamps: true, suppressReservedKeysWarning: true }
)

export default mongoose.models.WikiArticle ||
  mongoose.model('WikiArticle', wikiArticleSchema)
