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

export type SuperAdminSettingsDocument = HydratedDocument<SuperAdminSettings>;

@Schema({ timestamps: true, versionKey: false })
export class SuperAdminSettings {
  @Prop({ default: 'default', unique: true, index: true })
  scope!: string;

  @Prop({ default: 'Oudelaa SuperAdmin', trim: true, maxlength: 120 })
  siteName!: string;

  @Prop({ default: '', trim: true, maxlength: 200 })
  publicBaseUrl!: string;

  @Prop({ default: '', trim: true, maxlength: 200 })
  dashboardApiBaseUrl!: string;

  @Prop({ type: [String], default: [] })
  corsOrigins!: string[];

  @Prop({ default: false })
  maintenanceMode!: boolean;

  @Prop({ default: false })
  emailEnabled!: boolean;

  @Prop({ default: false })
  marketplaceAutoApprove!: boolean;

  @Prop({ default: false })
  contentAutoHideFlagged!: boolean;

  @Prop({ default: '', trim: true, maxlength: 1000 })
  notes!: string;

  @Prop({ default: '', trim: true, maxlength: 160 })
  updatedBy!: string;
}

export const SuperAdminSettingsSchema = SchemaFactory.createForClass(SuperAdminSettings);
