import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

@Schema({
    timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' },
})
export class Category extends Document {
    @Prop({ type: String, required: true, trim: true })
    name: string;

    @Prop({ type: Boolean, default: true })
    is_active: boolean;
}

export const CategorySchema = SchemaFactory.createForClass(Category);
CategorySchema.index({ name: 1 }, { unique: true, collation: { locale: 'en', strength: 2 } });
