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

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

const collection = "social-network-whatsapps";

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

customsSchema(Schema);

const connectItem = SocialNetworkWhatsappsSchema.swagger({
  _id: "String",
  ...SocialNetworkWhatsappsSchema.schemas.connectSchema,
}).definitions;
const sendMessageItem = SocialNetworkWhatsappsSchema.swagger({
  _id: "String",
  ...SocialNetworkWhatsappsSchema.schemas.sendMessageSchema,
}).definitions;
const getItem = SocialNetworkWhatsappsSchema.swagger({
  _id: "String",
  ...SocialNetworkWhatsappsSchema.schemas.parentSchema,
}).definitions;
const deleteItem = DeleteSchema.swagger(
  DeleteSchema.schemas.parentSchema
).definitions;

export const SocialNetworkWhatsappsModel = mongoose.model(collection, Schema);
export const SocialNetworkWhatsappsModelSwagger = {
  SocialNetworkWhatsappsConnectItem: {
    type: "object",
    properties: connectItem,
  },
  SocialNetworkWhatsappsSendMessageItem: {
    type: "object",
    properties: sendMessageItem,
  },
  SocialNetworkWhatsappsGetItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkWhatsappsGetItems: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkWhatsappsCreateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkWhatsappsUpdateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkWhatsappsDeleteItem: {
    type: "object",
    properties: deleteItem,
  },
};
