/**
 * User Model
 */
import { Post } from '../Models/Post.js';
import { Model } from '../../src/orm/Model.js';
/**
 * User Model Definition
 */
export const User = Model.define({
    table: 'users',
    fillable: ['name', 'email', 'password'],
    hidden: ['password'],
    timestamps: true,
    casts: {
        email_verified_at: 'datetime',
    },
}, {
    /**
     * Get user's profile
     */
    profile(_model) {
        return undefined; // Placeholder
    },
    /**
     * Get user's posts
     */
    posts(model) {
        return model.hasMany(Post);
    },
    /**
     * Check if user is admin
     */
    isAdmin(model) {
        return model.getAttribute('is_admin') === 1;
    },
    /**
     * Get user's full name
     */
    getFullName(model) {
        const name = model.getAttribute('name');
        return typeof name === 'string' ? name : '';
    },
});
export default User;
