import{Schema as e}from"mongoose";import{commonModeSchemaOptions as t,addIdVirtualFields as n}from"@common-stack/store-mongo";const o=new e({name:{type:e.Types.String,required:!0,maxlength:150},country:{type:e.Types.String,ref:"countries",onDelete:"cascade"},location:{type:{type:e.Types.String,default:"Point",enum:["Point"]},coordinates:{type:[e.Types.Number],required:!0}},_id:{type:e.Types.String,required:!0,unique:!0}},{...t,_id:!1});o.index({name:1,country:1},{unique:!0}),o.index({_id:1,country:1},{unique:!0}),o.index({location:"2dsphere"}),n(o);const i=e=>e.model("states",o);export{i as StateModelFunc};