var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { withAuthFinder } from '@adonisjs/auth/mixins/lucid';
import { compose } from '@adonisjs/core/helpers';
import hash from '@adonisjs/core/services/hash';
import { column } from '@adonisjs/lucid/orm';
import '@akago/vine-lucid';
import { VineModel } from '@akago/vine-lucid';
import vine from '@vinejs/vine';
import '../../../lib/vine_types/vine_attachment.js';
import '../../../lib/vine_types/vine_dateiso.js';
import '../../../lib/vine_types/vine_enum_with_values.js';
import { AKAuditableModel } from '../../crud/model.js';
export const passwordSchema = vine
    .string()
    .regex(/^(?=.*\d)(?=.*[~`!@#$%^&*()--+={}\[\]|\\:;"'<>,.?/_₹])(?=.*[a-zA-Z]).{8,64}$/);
export const AKUserModelMixin = (superclass) => {
    class AKUserModel extends superclass {
        static excludeFromUpdate = [
            ...super.excludeFromUpdate,
            'isAdmin',
            'email',
            'password',
            'disabledAt',
        ];
        get enabledNotificationsEmail() {
            return [];
        }
        get enabledNotificationsWeb() {
            return [];
        }
    }
    __decorate([
        VineModel(vine.boolean()),
        column(),
        __metadata("design:type", Boolean)
    ], AKUserModel.prototype, "isAdmin", void 0);
    __decorate([
        VineModel(vine.string().email()),
        column(),
        __metadata("design:type", String)
    ], AKUserModel.prototype, "email", void 0);
    __decorate([
        VineModel(passwordSchema),
        column({ serializeAs: null }),
        __metadata("design:type", String)
    ], AKUserModel.prototype, "password", void 0);
    __decorate([
        VineModel(vine.date()),
        column.dateTime(),
        __metadata("design:type", Object)
    ], AKUserModel.prototype, "disabledAt", void 0);
    __decorate([
        column(),
        __metadata("design:type", Object)
    ], AKUserModel.prototype, "disabledReason", void 0);
    return AKUserModel;
};
const AuthFinder = withAuthFinder(() => hash.use('scrypt'), {
    uids: ['email'],
    passwordColumnName: 'password',
});
export const AKUserModel = compose(AKAuditableModel, AKUserModelMixin, AuthFinder);
//# sourceMappingURL=user.js.map