import mongoose, { Schema, Document, models } from "mongoose";
import { Base } from "./base";

interface IBuildArea extends Base, Document {
    build: mongoose.Types.ObjectId;
    area: number;
    size: number;
    type: string;
    typeToken: string;
    description: string;
}

const BuildAreaSchema = new Schema<IBuildArea>({
    build: { type: Schema.Types.ObjectId, ref: "Build", required: true },
    area: { type: Number, required: true },
    size: { type: Number, required: true },
    type: { type: String, required: true },
    typeToken: { type: String, required: true },
    description: { type: String, required: true },
}, { timestamps: true });

const BuildArea = models.BuildArea || mongoose.model<IBuildArea>("BuildArea", BuildAreaSchema);

export { BuildArea, BuildAreaSchema };
export type { IBuildArea };
