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

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

const collection = "social-network-providers";

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

customsSchema(Schema);

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

export const SocialNetworkProvidersModel = mongoose.model(collection, Schema);
export const SocialNetworkProvidersModelSwagger = {
  SocialNetworkProvidersGetItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkProvidersGetItems: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkProvidersCreateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkProvidersUpdateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkProvidersDeleteItem: {
    type: "object",
    properties: deleteItem,
  },
};
