import * as Sequelize from 'sequelize';
import { DataTypes, Model, Optional } from 'sequelize';
export interface UserSessionsDetailedAttributes {
	id?: string | null;
	user_id?: string | null;
	token_version?: number | null;
	status?: 'active' | 'revoked' | 'expired' | 'logged_out' | null;
	device_info?: object | null;
	ip_address?: string | null;
	user_agent?: string | null;
	expires_at?: Date | null;
	refresh_expires_at?: Date | null;
	created_at?: Date | null;
	updated_at?: Date | null;
	last_activity_at?: Date | null;
	platform?: 'web' | 'mobile' | 'zalo_miniapp' | 'internal' | null;
	device_id?: string | null;
	device_name?: string | null;
	revoked_at?: Date | null;
	logged_out_at?: Date | null;
	tenant_id?: string | null;
	refresh_token_hash?: string | null;
	access_token_hash?: string | null;
	email?: string | null;
	username?: string | null;
	first_name?: string | null;
	last_name?: string | null;
	user_status?: 'active' | 'inactive' | 'suspended' | 'pending_verification' | null;
}
export type UserSessionsDetailedPk = 'id';
export type UserSessionsDetailedId = UserSessionsDetailed[UserSessionsDetailedPk];
export type UserSessionsDetailedOptionalAttributes =
	| 'id'
	| 'user_id'
	| 'token_version'
	| 'status'
	| 'device_info'
	| 'ip_address'
	| 'user_agent'
	| 'expires_at'
	| 'refresh_expires_at'
	| 'created_at'
	| 'updated_at'
	| 'last_activity_at'
	| 'platform'
	| 'device_id'
	| 'device_name'
	| 'revoked_at'
	| 'logged_out_at'
	| 'tenant_id'
	| 'refresh_token_hash'
	| 'access_token_hash'
	| 'email'
	| 'username'
	| 'first_name'
	| 'last_name'
	| 'user_status';
export type UserSessionsDetailedCreationAttributes = Optional<
	UserSessionsDetailedAttributes,
	UserSessionsDetailedOptionalAttributes
>;
export class UserSessionsDetailed
	extends Model<UserSessionsDetailedAttributes>
	implements UserSessionsDetailedAttributes
{
	id?: string;
	declare user_id?: string | null;
	declare token_version?: number | null;
	declare status?: 'active' | 'revoked' | 'expired' | 'logged_out' | null;
	declare device_info?: object | null;
	declare ip_address?: string | null;
	declare user_agent?: string | null;
	declare expires_at?: Date | null;
	declare refresh_expires_at?: Date | null;
	declare created_at?: Date | null;
	declare updated_at?: Date | null;
	declare last_activity_at?: Date | null;
	declare platform?: 'web' | 'mobile' | 'zalo_miniapp' | 'internal' | null;
	declare device_id?: string | null;
	declare device_name?: string | null;
	declare revoked_at?: Date | null;
	declare logged_out_at?: Date | null;
	declare tenant_id?: string | null;
	declare refresh_token_hash?: string | null;
	declare access_token_hash?: string | null;
	declare email?: string | null;
	declare username?: string | null;
	declare first_name?: string | null;
	declare last_name?: string | null;
	declare user_status?: 'active' | 'inactive' | 'suspended' | 'pending_verification' | null;
	static initModel(sequelize: Sequelize.Sequelize): typeof UserSessionsDetailed {
		return UserSessionsDetailed.init(
			{
				id: {
					type: DataTypes.UUID,
					allowNull: true,
					primaryKey: true,
				},
				user_id: {
					type: DataTypes.UUID,
					allowNull: true,
				},
				token_version: {
					type: DataTypes.INTEGER,
					allowNull: true,
				},
				status: {
					type: DataTypes.ENUM('active', 'revoked', 'expired', 'logged_out'),
					allowNull: true,
				},
				device_info: {
					type: DataTypes.JSONB,
					allowNull: true,
				},
				ip_address: {
					type: DataTypes.INET,
					allowNull: true,
				},
				user_agent: {
					type: DataTypes.TEXT,
					allowNull: true,
				},
				expires_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				refresh_expires_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				created_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				updated_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				last_activity_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				platform: {
					type: DataTypes.ENUM('web', 'mobile', 'zalo_miniapp', 'internal'),
					allowNull: true,
				},
				device_id: {
					type: DataTypes.STRING(255),
					allowNull: true,
				},
				device_name: {
					type: DataTypes.STRING(255),
					allowNull: true,
				},
				revoked_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				logged_out_at: {
					type: DataTypes.DATE,
					allowNull: true,
				},
				tenant_id: {
					type: DataTypes.UUID,
					allowNull: true,
				},
				refresh_token_hash: {
					type: DataTypes.STRING(64),
					allowNull: true,
				},
				access_token_hash: {
					type: DataTypes.STRING(64),
					allowNull: true,
				},
				email: {
					type: DataTypes.TEXT,
					allowNull: true,
				},
				username: {
					type: DataTypes.TEXT,
					allowNull: true,
				},
				first_name: {
					type: DataTypes.STRING(100),
					allowNull: true,
				},
				last_name: {
					type: DataTypes.STRING(100),
					allowNull: true,
				},
				user_status: {
					type: DataTypes.ENUM('active', 'inactive', 'suspended', 'pending_verification'),
					allowNull: true,
				},
			},
			{
				sequelize,
				tableName: 'user_sessions_detailed',
				schema: 'public',
				timestamps: false,
			},
		);
	}
}
