import DB from "../database.js";
import { ModelDataBase } from "@hibas123/safe_mongo/lib/model.js";
import { ObjectId } from "mongodb";
import { v4 } from "uuid";

export interface IRegCode extends ModelDataBase {
   token: string;
   valid: boolean;
   validTill: Date;
}

const RegCode = DB.addModel<IRegCode>({
   name: "reg_code",
   versions: [
      {
         migration: () => { },
         schema: {
            token: { type: String },
            valid: { type: Boolean },
            validTill: { type: Date },
         },
      },
   ],
});

export default RegCode;

// import { Model, Table, Column, ForeignKey, BelongsTo, Unique, CreatedAt, UpdatedAt, DeletedAt, HasMany, BelongsToMany, Default, DataType } from "sequelize-typescript"
// import User from "./user";
// import Permission from "./permissions";
// import RefreshPermission from "./refresh_permission";

// @Table
// export default class RegCode extends Model<RegCode> {
//    @Unique
//    @Default(DataType.UUIDV4)
//    @Column(DataType.UUID)
//    token: string

//    @Column
//    validTill: Date

//    @Column
//    valid: boolean

//    @Column
//    @CreatedAt
//    creationDate: Date;

//    @Column
//    @UpdatedAt
//    updatedOn: Date;

//    @Column
//    @DeletedAt
//    deletionDate: Date;
// }
