import { schema as SocialNetworksSchema } from "../../schemas/social-network/social-network.schema";
import { schema as DeleteSchema } from "../../schemas/delete.schema";

import mongoose from "mongoose";
import { customsSchema } from "../abstract.model";

const collection = "social-networks";

const schemaModelsMongoose = SocialNetworksSchema.mongoose(
  SocialNetworksSchema.schemas.parentSchema
);
const AbstractSchemaOptions = {
  timestamps: true,
  versionKey: false,
};
const Schema = new mongoose.Schema(schemaModelsMongoose, AbstractSchemaOptions);

customsSchema(Schema);

const getItem = SocialNetworksSchema.swagger({
  _id: "String",
  ...SocialNetworksSchema.schemas.parentSchema,
}).definitions;
const deleteItem = DeleteSchema.swagger(
  DeleteSchema.schemas.parentSchema
).definitions;

export const SocialNetworksModel = mongoose.model(collection, Schema);
export const SocialNetworksModelSwagger = {
  SocialNetworksGetItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworksGetItems: {
    type: "object",
    properties: getItem,
  },
  SocialNetworksCreateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworksUpdateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworksDeleteItem: {
    type: "object",
    properties: deleteItem,
  },
};
