import { schema as SocialNetworkEmailsSchema } from "../../schemas/social-network/social-network-email.schema";

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

const collection = "social-network-emails";

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

customsSchema(Schema);

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

const sendVerification = SocialNetworkEmailsSchema.swagger({
  ...SocialNetworkEmailsSchema.schemas.sendVerificationSchema,
}).definitions;

const verify = SocialNetworkEmailsSchema.swagger({
  ...SocialNetworkEmailsSchema.schemas.verifySchema,
}).definitions;

const sendItem = SocialNetworkEmailsSchema.swagger({
  _id: "String",
  ...SocialNetworkEmailsSchema.schemas.emailSchema,
}).definitions;
const responseItem = SocialNetworkEmailsSchema.swagger({
  _id: "String",
  ...SocialNetworkEmailsSchema.schemas.responseSchema,
}).definitions;

export const SocialNetworkEmailsModel = mongoose.model(collection, Schema);
export const SocialNetworkEmailsModelSwagger = {
  SocialNetworkEmailsSendVerification: {
    type: "object",
    properties: sendVerification,
  },
  SocialNetworkEmailsVerify: {
    type: "object",
    properties: verify,
  },
  SocialNetworkEmailsGetItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkEmailsGetItems: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkEmailsCreateItem: {
    type: "object",
    properties: getItem,
  },
  SocialNetworkEmailSendItem: {
    type: "object",
    properties: sendItem,
  },
  SocialNetworkEmailResponseItem: {
    type: "object",
    properties: responseItem,
  },
};
