import type { Sequelize } from 'sequelize';
import { ActiveApartment as _ActiveApartment } from './ActiveApartment';
import type { ActiveApartmentAttributes, ActiveApartmentCreationAttributes } from './ActiveApartment';
import { ActiveBed as _ActiveBed } from './ActiveBed';
import type { ActiveBedAttributes, ActiveBedCreationAttributes } from './ActiveBed';
import { ActiveBuilding as _ActiveBuilding } from './ActiveBuilding';
import type { ActiveBuildingAttributes, ActiveBuildingCreationAttributes } from './ActiveBuilding';
import { ActiveResidentStay as _ActiveResidentStay } from './ActiveResidentStay';
import type { ActiveResidentStayAttributes, ActiveResidentStayCreationAttributes } from './ActiveResidentStay';
import { ActiveResident as _ActiveResident } from './ActiveResident';
import type { ActiveResidentAttributes, ActiveResidentCreationAttributes } from './ActiveResident';
import { ActiveRoom as _ActiveRoom } from './ActiveRoom';
import type { ActiveRoomAttributes, ActiveRoomCreationAttributes } from './ActiveRoom';
import { ActiveUser as _ActiveUser } from './ActiveUser';
import type { ActiveUserAttributes, ActiveUserCreationAttributes } from './ActiveUser';
import { Apartment as _Apartment } from './Apartment';
import type { ApartmentAttributes, ApartmentCreationAttributes } from './Apartment';
import { AuditDeadLetter as _AuditDeadLetter } from './AuditDeadLetter';
import type { AuditDeadLetterAttributes, AuditDeadLetterCreationAttributes } from './AuditDeadLetter';
import { AuditOutbox as _AuditOutbox } from './AuditOutbox';
import type { AuditOutboxAttributes, AuditOutboxCreationAttributes } from './AuditOutbox';
import { AuthAuditLog as _AuthAuditLog } from './AuthAuditLog';
import type { AuthAuditLogAttributes, AuthAuditLogCreationAttributes } from './AuthAuditLog';
import { AuthAuditLogsDefault as _AuthAuditLogsDefault } from './AuthAuditLogsDefault';
import type { AuthAuditLogsDefaultAttributes, AuthAuditLogsDefaultCreationAttributes } from './AuthAuditLogsDefault';
import { Bed as _Bed } from './Bed';
import type { BedAttributes, BedCreationAttributes } from './Bed';
import { BillItem as _BillItem } from './BillItem';
import type { BillItemAttributes, BillItemCreationAttributes } from './BillItem';
import { Bill as _Bill } from './Bill';
import type { BillAttributes, BillCreationAttributes } from './Bill';
import { Building as _Building } from './Building';
import type { BuildingAttributes, BuildingCreationAttributes } from './Building';
import { Client as _Client } from './Client';
import type { ClientAttributes, ClientCreationAttributes } from './Client';
import { ContractFile as _ContractFile } from './ContractFile';
import type { ContractFileAttributes, ContractFileCreationAttributes } from './ContractFile';
import { ContractType as _ContractType } from './ContractType';
import type { ContractTypeAttributes, ContractTypeCreationAttributes } from './ContractType';
import { Contract as _Contract } from './Contract';
import type { ContractAttributes, ContractCreationAttributes } from './Contract';
import { DebtReminderPolicy as _DebtReminderPolicy } from './DebtReminderPolicy';
import type { DebtReminderPolicyAttributes, DebtReminderPolicyCreationAttributes } from './DebtReminderPolicy';
import { DebtReminderPolicyTarget as _DebtReminderPolicyTarget } from './DebtReminderPolicyTarget';
import type {
	DebtReminderPolicyTargetAttributes,
	DebtReminderPolicyTargetCreationAttributes,
} from './DebtReminderPolicyTarget';
import { EmailVerifyToken as _EmailVerifyToken } from './EmailVerifyToken';
import type { EmailVerifyTokenAttributes, EmailVerifyTokenCreationAttributes } from './EmailVerifyToken';
import { EntityChangeLog as _EntityChangeLog } from './EntityChangeLog';
import type { EntityChangeLogAttributes, EntityChangeLogCreationAttributes } from './EntityChangeLog';
import { EntityChangeLogsDefault as _EntityChangeLogsDefault } from './EntityChangeLogsDefault';
import type {
	EntityChangeLogsDefaultAttributes,
	EntityChangeLogsDefaultCreationAttributes,
} from './EntityChangeLogsDefault';
import { FileVariant as _FileVariant } from './FileVariant';
import type { FileVariantAttributes, FileVariantCreationAttributes } from './FileVariant';
import { File as _File } from './File';
import type { FileAttributes, FileCreationAttributes } from './File';
import { IncidentFile as _IncidentFile } from './IncidentFile';
import type { IncidentFileAttributes, IncidentFileCreationAttributes } from './IncidentFile';
import { IncidentType as _IncidentType } from './IncidentType';
import type { IncidentTypeAttributes, IncidentTypeCreationAttributes } from './IncidentType';
import { Incident as _Incident } from './Incident';
import type { IncidentAttributes, IncidentCreationAttributes } from './Incident';
import { NotificationDeliveryAttempt as _NotificationDeliveryAttempt } from './NotificationDeliveryAttempt';
import type {
	NotificationDeliveryAttemptAttributes,
	NotificationDeliveryAttemptCreationAttributes,
} from './NotificationDeliveryAttempt';
import { NotificationDevice as _NotificationDevice } from './NotificationDevice';
import type { NotificationDeviceAttributes, NotificationDeviceCreationAttributes } from './NotificationDevice';
import { NotificationMessage as _NotificationMessage } from './NotificationMessage';
import type { NotificationMessageAttributes, NotificationMessageCreationAttributes } from './NotificationMessage';
import { NotificationPreference as _NotificationPreference } from './NotificationPreference';
import type {
	NotificationPreferenceAttributes,
	NotificationPreferenceCreationAttributes,
} from './NotificationPreference';
import { NotificationReceipt as _NotificationReceipt } from './NotificationReceipt';
import type { NotificationReceiptAttributes, NotificationReceiptCreationAttributes } from './NotificationReceipt';
import { NotificationTemplate as _NotificationTemplate } from './NotificationTemplate';
import type { NotificationTemplateAttributes, NotificationTemplateCreationAttributes } from './NotificationTemplate';
import { PasswordResetToken as _PasswordResetToken } from './PasswordResetToken';
import type { PasswordResetTokenAttributes, PasswordResetTokenCreationAttributes } from './PasswordResetToken';
import { Permission as _Permission } from './Permission';
import type { PermissionAttributes, PermissionCreationAttributes } from './Permission';
import { PostTarget as _PostTarget } from './PostTarget';
import type { PostTargetAttributes, PostTargetCreationAttributes } from './PostTarget';
import { Post as _Post } from './Post';
import type { PostAttributes, PostCreationAttributes } from './Post';
import { RefreshTokenAuditLog as _RefreshTokenAuditLog } from './RefreshTokenAuditLog';
import type { RefreshTokenAuditLogAttributes, RefreshTokenAuditLogCreationAttributes } from './RefreshTokenAuditLog';
import { RefreshTokenAuditLogsDefault as _RefreshTokenAuditLogsDefault } from './RefreshTokenAuditLogsDefault';
import type {
	RefreshTokenAuditLogsDefaultAttributes,
	RefreshTokenAuditLogsDefaultCreationAttributes,
} from './RefreshTokenAuditLogsDefault';
import { ResidentCurrentLocation as _ResidentCurrentLocation } from './ResidentCurrentLocation';
import type {
	ResidentCurrentLocationAttributes,
	ResidentCurrentLocationCreationAttributes,
} from './ResidentCurrentLocation';
import { ResidentDocument as _ResidentDocument } from './ResidentDocument';
import type { ResidentDocumentAttributes, ResidentDocumentCreationAttributes } from './ResidentDocument';
import { ResidentEvent as _ResidentEvent } from './ResidentEvent';
import type { ResidentEventAttributes, ResidentEventCreationAttributes } from './ResidentEvent';
import { ResidentStay as _ResidentStay } from './ResidentStay';
import type { ResidentStayAttributes, ResidentStayCreationAttributes } from './ResidentStay';
import { Resident as _Resident } from './Resident';
import type { ResidentAttributes, ResidentCreationAttributes } from './Resident';
import { RolePermission as _RolePermission } from './RolePermission';
import type { RolePermissionAttributes, RolePermissionCreationAttributes } from './RolePermission';
import { Role as _Role } from './Role';
import type { RoleAttributes, RoleCreationAttributes } from './Role';
import { Room as _Room } from './Room';
import type { RoomAttributes, RoomCreationAttributes } from './Room';
import { SchemaMigration as _SchemaMigration } from './SchemaMigration';
import type { SchemaMigrationAttributes, SchemaMigrationCreationAttributes } from './SchemaMigration';
import { SystemAuditLog as _SystemAuditLog } from './SystemAuditLog';
import type { SystemAuditLogAttributes, SystemAuditLogCreationAttributes } from './SystemAuditLog';
import { SystemAuditLogsDefault as _SystemAuditLogsDefault } from './SystemAuditLogsDefault';
import type {
	SystemAuditLogsDefaultAttributes,
	SystemAuditLogsDefaultCreationAttributes,
} from './SystemAuditLogsDefault';
import { SystemConfig as _SystemConfig } from './SystemConfig';
import type { SystemConfigAttributes, SystemConfigCreationAttributes } from './SystemConfig';
import { Technician as _Technician } from './Technician';
import type { TechnicianAttributes, TechnicianCreationAttributes } from './Technician';
import { UserAuth as _UserAuth } from './UserAuth';
import type { UserAuthAttributes, UserAuthCreationAttributes } from './UserAuth';
import { UserPasswordHistory as _UserPasswordHistory } from './UserPasswordHistory';
import type { UserPasswordHistoryAttributes, UserPasswordHistoryCreationAttributes } from './UserPasswordHistory';
import { UserRoleDetail as _UserRoleDetail } from './UserRoleDetail';
import type { UserRoleDetailAttributes, UserRoleDetailCreationAttributes } from './UserRoleDetail';
import { UserRole as _UserRole } from './UserRole';
import type { UserRoleAttributes, UserRoleCreationAttributes } from './UserRole';
import { UserSession as _UserSession } from './UserSession';
import type { UserSessionAttributes, UserSessionCreationAttributes } from './UserSession';
import { UserSessionsDetailed as _UserSessionsDetailed } from './UserSessionsDetailed';
import type { UserSessionsDetailedAttributes, UserSessionsDetailedCreationAttributes } from './UserSessionsDetailed';
import { User as _User } from './User';
import type { UserAttributes, UserCreationAttributes } from './User';
import { WebhookLog as _WebhookLog } from './WebhookLog';
import type { WebhookLogAttributes, WebhookLogCreationAttributes } from './WebhookLog';

export {
	_ActiveApartment as ActiveApartment,
	_ActiveBed as ActiveBed,
	_ActiveBuilding as ActiveBuilding,
	_ActiveResidentStay as ActiveResidentStay,
	_ActiveResident as ActiveResident,
	_ActiveRoom as ActiveRoom,
	_ActiveUser as ActiveUser,
	_Apartment as Apartment,
	_AuditDeadLetter as AuditDeadLetter,
	_AuditOutbox as AuditOutbox,
	_AuthAuditLog as AuthAuditLog,
	_AuthAuditLogsDefault as AuthAuditLogsDefault,
	_Bed as Bed,
	_BillItem as BillItem,
	_Bill as Bill,
	_Building as Building,
	_Client as Client,
	_ContractFile as ContractFile,
	_ContractType as ContractType,
	_Contract as Contract,
	_DebtReminderPolicy as DebtReminderPolicy,
	_DebtReminderPolicyTarget as DebtReminderPolicyTarget,
	_EmailVerifyToken as EmailVerifyToken,
	_EntityChangeLog as EntityChangeLog,
	_EntityChangeLogsDefault as EntityChangeLogsDefault,
	_FileVariant as FileVariant,
	_File as File,
	_IncidentFile as IncidentFile,
	_IncidentType as IncidentType,
	_Incident as Incident,
	_NotificationDeliveryAttempt as NotificationDeliveryAttempt,
	_NotificationDevice as NotificationDevice,
	_NotificationMessage as NotificationMessage,
	_NotificationPreference as NotificationPreference,
	_NotificationReceipt as NotificationReceipt,
	_NotificationTemplate as NotificationTemplate,
	_PasswordResetToken as PasswordResetToken,
	_Permission as Permission,
	_PostTarget as PostTarget,
	_Post as Post,
	_RefreshTokenAuditLog as RefreshTokenAuditLog,
	_RefreshTokenAuditLogsDefault as RefreshTokenAuditLogsDefault,
	_ResidentCurrentLocation as ResidentCurrentLocation,
	_ResidentDocument as ResidentDocument,
	_ResidentEvent as ResidentEvent,
	_ResidentStay as ResidentStay,
	_Resident as Resident,
	_RolePermission as RolePermission,
	_Role as Role,
	_Room as Room,
	_SchemaMigration as SchemaMigration,
	_SystemAuditLog as SystemAuditLog,
	_SystemAuditLogsDefault as SystemAuditLogsDefault,
	_SystemConfig as SystemConfig,
	_Technician as Technician,
	_UserAuth as UserAuth,
	_UserPasswordHistory as UserPasswordHistory,
	_UserRoleDetail as UserRoleDetail,
	_UserRole as UserRole,
	_UserSession as UserSession,
	_UserSessionsDetailed as UserSessionsDetailed,
	_User as User,
	_WebhookLog as WebhookLog,
};

export type {
	ActiveApartmentAttributes,
	ActiveApartmentCreationAttributes,
	ActiveBedAttributes,
	ActiveBedCreationAttributes,
	ActiveBuildingAttributes,
	ActiveBuildingCreationAttributes,
	ActiveResidentStayAttributes,
	ActiveResidentStayCreationAttributes,
	ActiveResidentAttributes,
	ActiveResidentCreationAttributes,
	ActiveRoomAttributes,
	ActiveRoomCreationAttributes,
	ActiveUserAttributes,
	ActiveUserCreationAttributes,
	ApartmentAttributes,
	ApartmentCreationAttributes,
	AuditDeadLetterAttributes,
	AuditDeadLetterCreationAttributes,
	AuditOutboxAttributes,
	AuditOutboxCreationAttributes,
	AuthAuditLogAttributes,
	AuthAuditLogCreationAttributes,
	AuthAuditLogsDefaultAttributes,
	AuthAuditLogsDefaultCreationAttributes,
	BedAttributes,
	BedCreationAttributes,
	BillItemAttributes,
	BillItemCreationAttributes,
	BillAttributes,
	BillCreationAttributes,
	BuildingAttributes,
	BuildingCreationAttributes,
	ClientAttributes,
	ClientCreationAttributes,
	ContractFileAttributes,
	ContractFileCreationAttributes,
	ContractTypeAttributes,
	ContractTypeCreationAttributes,
	ContractAttributes,
	ContractCreationAttributes,
	DebtReminderPolicyAttributes,
	DebtReminderPolicyCreationAttributes,
	DebtReminderPolicyTargetAttributes,
	DebtReminderPolicyTargetCreationAttributes,
	EmailVerifyTokenAttributes,
	EmailVerifyTokenCreationAttributes,
	EntityChangeLogAttributes,
	EntityChangeLogCreationAttributes,
	EntityChangeLogsDefaultAttributes,
	EntityChangeLogsDefaultCreationAttributes,
	FileVariantAttributes,
	FileVariantCreationAttributes,
	FileAttributes,
	FileCreationAttributes,
	IncidentFileAttributes,
	IncidentFileCreationAttributes,
	IncidentTypeAttributes,
	IncidentTypeCreationAttributes,
	IncidentAttributes,
	IncidentCreationAttributes,
	NotificationDeliveryAttemptAttributes,
	NotificationDeliveryAttemptCreationAttributes,
	NotificationDeviceAttributes,
	NotificationDeviceCreationAttributes,
	NotificationMessageAttributes,
	NotificationMessageCreationAttributes,
	NotificationPreferenceAttributes,
	NotificationPreferenceCreationAttributes,
	NotificationReceiptAttributes,
	NotificationReceiptCreationAttributes,
	NotificationTemplateAttributes,
	NotificationTemplateCreationAttributes,
	PasswordResetTokenAttributes,
	PasswordResetTokenCreationAttributes,
	PermissionAttributes,
	PermissionCreationAttributes,
	PostTargetAttributes,
	PostTargetCreationAttributes,
	PostAttributes,
	PostCreationAttributes,
	RefreshTokenAuditLogAttributes,
	RefreshTokenAuditLogCreationAttributes,
	RefreshTokenAuditLogsDefaultAttributes,
	RefreshTokenAuditLogsDefaultCreationAttributes,
	ResidentCurrentLocationAttributes,
	ResidentCurrentLocationCreationAttributes,
	ResidentDocumentAttributes,
	ResidentDocumentCreationAttributes,
	ResidentEventAttributes,
	ResidentEventCreationAttributes,
	ResidentStayAttributes,
	ResidentStayCreationAttributes,
	ResidentAttributes,
	ResidentCreationAttributes,
	RolePermissionAttributes,
	RolePermissionCreationAttributes,
	RoleAttributes,
	RoleCreationAttributes,
	RoomAttributes,
	RoomCreationAttributes,
	SchemaMigrationAttributes,
	SchemaMigrationCreationAttributes,
	SystemAuditLogAttributes,
	SystemAuditLogCreationAttributes,
	SystemAuditLogsDefaultAttributes,
	SystemAuditLogsDefaultCreationAttributes,
	SystemConfigAttributes,
	SystemConfigCreationAttributes,
	TechnicianAttributes,
	TechnicianCreationAttributes,
	UserAuthAttributes,
	UserAuthCreationAttributes,
	UserPasswordHistoryAttributes,
	UserPasswordHistoryCreationAttributes,
	UserRoleDetailAttributes,
	UserRoleDetailCreationAttributes,
	UserRoleAttributes,
	UserRoleCreationAttributes,
	UserSessionAttributes,
	UserSessionCreationAttributes,
	UserSessionsDetailedAttributes,
	UserSessionsDetailedCreationAttributes,
	UserAttributes,
	UserCreationAttributes,
	WebhookLogAttributes,
	WebhookLogCreationAttributes,
};

export function initModels(sequelize: Sequelize) {
	const ActiveApartment = _ActiveApartment.initModel(sequelize);
	const ActiveBed = _ActiveBed.initModel(sequelize);
	const ActiveBuilding = _ActiveBuilding.initModel(sequelize);
	const ActiveResidentStay = _ActiveResidentStay.initModel(sequelize);
	const ActiveResident = _ActiveResident.initModel(sequelize);
	const ActiveRoom = _ActiveRoom.initModel(sequelize);
	const ActiveUser = _ActiveUser.initModel(sequelize);
	const Apartment = _Apartment.initModel(sequelize);
	const AuditDeadLetter = _AuditDeadLetter.initModel(sequelize);
	const AuditOutbox = _AuditOutbox.initModel(sequelize);
	const AuthAuditLog = _AuthAuditLog.initModel(sequelize);
	const AuthAuditLogsDefault = _AuthAuditLogsDefault.initModel(sequelize);
	const Bed = _Bed.initModel(sequelize);
	const BillItem = _BillItem.initModel(sequelize);
	const Bill = _Bill.initModel(sequelize);
	const Building = _Building.initModel(sequelize);
	const Client = _Client.initModel(sequelize);
	const ContractFile = _ContractFile.initModel(sequelize);
	const ContractType = _ContractType.initModel(sequelize);
	const Contract = _Contract.initModel(sequelize);
	const DebtReminderPolicy = _DebtReminderPolicy.initModel(sequelize);
	const DebtReminderPolicyTarget = _DebtReminderPolicyTarget.initModel(sequelize);
	const EmailVerifyToken = _EmailVerifyToken.initModel(sequelize);
	const EntityChangeLog = _EntityChangeLog.initModel(sequelize);
	const EntityChangeLogsDefault = _EntityChangeLogsDefault.initModel(sequelize);
	const FileVariant = _FileVariant.initModel(sequelize);
	const File = _File.initModel(sequelize);
	const IncidentFile = _IncidentFile.initModel(sequelize);
	const IncidentType = _IncidentType.initModel(sequelize);
	const Incident = _Incident.initModel(sequelize);
	const NotificationDeliveryAttempt = _NotificationDeliveryAttempt.initModel(sequelize);
	const NotificationDevice = _NotificationDevice.initModel(sequelize);
	const NotificationMessage = _NotificationMessage.initModel(sequelize);
	const NotificationPreference = _NotificationPreference.initModel(sequelize);
	const NotificationReceipt = _NotificationReceipt.initModel(sequelize);
	const NotificationTemplate = _NotificationTemplate.initModel(sequelize);
	const PasswordResetToken = _PasswordResetToken.initModel(sequelize);
	const Permission = _Permission.initModel(sequelize);
	const PostTarget = _PostTarget.initModel(sequelize);
	const Post = _Post.initModel(sequelize);
	const RefreshTokenAuditLog = _RefreshTokenAuditLog.initModel(sequelize);
	const RefreshTokenAuditLogsDefault = _RefreshTokenAuditLogsDefault.initModel(sequelize);
	const ResidentCurrentLocation = _ResidentCurrentLocation.initModel(sequelize);
	const ResidentDocument = _ResidentDocument.initModel(sequelize);
	const ResidentEvent = _ResidentEvent.initModel(sequelize);
	const ResidentStay = _ResidentStay.initModel(sequelize);
	const Resident = _Resident.initModel(sequelize);
	const RolePermission = _RolePermission.initModel(sequelize);
	const Role = _Role.initModel(sequelize);
	const Room = _Room.initModel(sequelize);
	const SchemaMigration = _SchemaMigration.initModel(sequelize);
	const SystemAuditLog = _SystemAuditLog.initModel(sequelize);
	const SystemAuditLogsDefault = _SystemAuditLogsDefault.initModel(sequelize);
	const SystemConfig = _SystemConfig.initModel(sequelize);
	const Technician = _Technician.initModel(sequelize);
	const UserAuth = _UserAuth.initModel(sequelize);
	const UserPasswordHistory = _UserPasswordHistory.initModel(sequelize);
	const UserRoleDetail = _UserRoleDetail.initModel(sequelize);
	const UserRole = _UserRole.initModel(sequelize);
	const UserSession = _UserSession.initModel(sequelize);
	const UserSessionsDetailed = _UserSessionsDetailed.initModel(sequelize);
	const User = _User.initModel(sequelize);
	const WebhookLog = _WebhookLog.initModel(sequelize);

	AuthAuditLog.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(AuthAuditLog, { as: 'auth_audit_logs', foreignKey: 'user_id' });
	AuthAuditLogsDefault.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(AuthAuditLogsDefault, { as: 'auth_audit_logs_defaults', foreignKey: 'user_id' });
	EntityChangeLog.belongsTo(User, { as: 'actor', foreignKey: 'actor_id' });
	User.hasMany(EntityChangeLog, { as: 'entity_change_logs', foreignKey: 'actor_id' });
	EntityChangeLogsDefault.belongsTo(User, { as: 'actor', foreignKey: 'actor_id' });
	User.hasMany(EntityChangeLogsDefault, { as: 'entity_change_logs_defaults', foreignKey: 'actor_id' });
	RefreshTokenAuditLog.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(RefreshTokenAuditLog, { as: 'refresh_token_audit_logs', foreignKey: 'user_id' });
	RefreshTokenAuditLogsDefault.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(RefreshTokenAuditLogsDefault, { as: 'refresh_token_audit_logs_defaults', foreignKey: 'user_id' });
	SystemAuditLog.belongsTo(User, { as: 'actor', foreignKey: 'actor_id' });
	User.hasMany(SystemAuditLog, { as: 'system_audit_logs', foreignKey: 'actor_id' });
	SystemAuditLogsDefault.belongsTo(User, { as: 'actor', foreignKey: 'actor_id' });
	User.hasMany(SystemAuditLogsDefault, { as: 'system_audit_logs_defaults', foreignKey: 'actor_id' });
	Room.belongsTo(Apartment, { as: 'apartment', foreignKey: 'apartment_id' });
	Apartment.hasMany(Room, { as: 'rooms', foreignKey: 'apartment_id' });
	ResidentStay.belongsTo(Bed, { as: 'bed', foreignKey: 'bed_id' });
	Bed.hasMany(ResidentStay, { as: 'resident_stays', foreignKey: 'bed_id' });
	BillItem.belongsTo(Bill, { as: 'bill', foreignKey: 'bill_id' });
	Bill.hasMany(BillItem, { as: 'bill_items', foreignKey: 'bill_id' });
	Bill.belongsTo(Room, { as: 'room', foreignKey: 'room_id' });
	Room.hasMany(Bill, { as: 'bills', foreignKey: 'room_id' });
	Bill.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(Bill, { as: 'bills', foreignKey: 'resident_id' });
	Apartment.belongsTo(Building, { as: 'building', foreignKey: 'building_id' });
	Building.hasMany(Apartment, { as: 'apartments', foreignKey: 'building_id' });
	Contract.belongsTo(ContractType, { as: 'contract_type', foreignKey: 'contract_type_id' });
	ContractType.hasMany(Contract, { as: 'contracts', foreignKey: 'contract_type_id' });
	ContractFile.belongsTo(Contract, { as: 'contract', foreignKey: 'contract_id' });
	Contract.hasMany(ContractFile, { as: 'contract_files', foreignKey: 'contract_id' });
	DebtReminderPolicyTarget.belongsTo(DebtReminderPolicy, { as: 'policy', foreignKey: 'policy_id' });
	DebtReminderPolicy.hasMany(DebtReminderPolicyTarget, { as: 'debt_reminder_policy_targets', foreignKey: 'policy_id' });
	ContractFile.belongsTo(File, { as: 'file', foreignKey: 'file_id' });
	File.hasMany(ContractFile, { as: 'contract_files', foreignKey: 'file_id' });
	FileVariant.belongsTo(File, { as: 'file', foreignKey: 'file_id' });
	File.hasMany(FileVariant, { as: 'file_variants', foreignKey: 'file_id' });
	IncidentFile.belongsTo(File, { as: 'file', foreignKey: 'file_id' });
	File.hasMany(IncidentFile, { as: 'incident_files', foreignKey: 'file_id' });
	Post.belongsTo(File, { as: 'thumbnail', foreignKey: 'thumbnail_id' });
	File.hasMany(Post, { as: 'posts', foreignKey: 'thumbnail_id' });
	ResidentDocument.belongsTo(File, { as: 'file', foreignKey: 'file_id' });
	File.hasMany(ResidentDocument, { as: 'resident_documents', foreignKey: 'file_id' });
	Technician.belongsTo(File, { as: 'avatar', foreignKey: 'avatar_id' });
	File.hasMany(Technician, { as: 'technicians', foreignKey: 'avatar_id' });
	User.belongsTo(File, { as: 'avatar', foreignKey: 'avatar_id' });
	File.hasMany(User, { as: 'users', foreignKey: 'avatar_id' });
	Incident.belongsTo(IncidentType, { as: 'type', foreignKey: 'type_id' });
	IncidentType.hasMany(Incident, { as: 'incidents', foreignKey: 'type_id' });
	IncidentFile.belongsTo(Incident, { as: 'incident', foreignKey: 'incident_id' });
	Incident.hasMany(IncidentFile, { as: 'incident_files', foreignKey: 'incident_id' });
	NotificationDeliveryAttempt.belongsTo(NotificationDevice, { as: 'device', foreignKey: 'device_id' });
	NotificationDevice.hasMany(NotificationDeliveryAttempt, {
		as: 'notification_delivery_attempts',
		foreignKey: 'device_id',
	});
	NotificationReceipt.belongsTo(NotificationMessage, { as: 'message', foreignKey: 'message_id' });
	NotificationMessage.hasMany(NotificationReceipt, { as: 'notification_receipts', foreignKey: 'message_id' });
	NotificationDeliveryAttempt.belongsTo(NotificationReceipt, { as: 'receipt', foreignKey: 'receipt_id' });
	NotificationReceipt.hasMany(NotificationDeliveryAttempt, {
		as: 'notification_delivery_attempts',
		foreignKey: 'receipt_id',
	});
	RolePermission.belongsTo(Permission, { as: 'permission', foreignKey: 'permission_id' });
	Permission.hasMany(RolePermission, { as: 'role_permissions', foreignKey: 'permission_id' });
	PostTarget.belongsTo(Post, { as: 'post', foreignKey: 'post_id' });
	Post.hasMany(PostTarget, { as: 'post_targets', foreignKey: 'post_id' });
	Contract.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(Contract, { as: 'contracts', foreignKey: 'resident_id' });
	ResidentDocument.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(ResidentDocument, { as: 'resident_documents', foreignKey: 'resident_id' });
	ResidentEvent.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(ResidentEvent, { as: 'resident_events', foreignKey: 'resident_id' });
	ResidentStay.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(ResidentStay, { as: 'resident_stays', foreignKey: 'resident_id' });
	WebhookLog.belongsTo(Resident, { as: 'resident', foreignKey: 'resident_id' });
	Resident.hasMany(WebhookLog, { as: 'webhook_logs', foreignKey: 'resident_id' });
	RolePermission.belongsTo(Role, { as: 'role', foreignKey: 'role_id' });
	Role.hasMany(RolePermission, { as: 'role_permissions', foreignKey: 'role_id' });
	UserRole.belongsTo(Role, { as: 'role', foreignKey: 'role_id' });
	Role.hasMany(UserRole, { as: 'user_roles', foreignKey: 'role_id' });
	Bed.belongsTo(Room, { as: 'room', foreignKey: 'room_id' });
	Room.hasMany(Bed, { as: 'beds', foreignKey: 'room_id' });
	Incident.belongsTo(Room, { as: 'room', foreignKey: 'room_id' });
	Room.hasMany(Incident, { as: 'incidents', foreignKey: 'room_id' });
	Incident.belongsTo(Technician, { as: 'technician', foreignKey: 'technician_id' });
	Technician.hasMany(Incident, { as: 'incidents', foreignKey: 'technician_id' });
	Apartment.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Apartment, { as: 'apartments', foreignKey: 'created_by' });
	Apartment.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Apartment, { as: 'deleted_by_apartments', foreignKey: 'deleted_by' });
	Apartment.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Apartment, { as: 'updated_by_apartments', foreignKey: 'updated_by' });
	Bed.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Bed, { as: 'beds', foreignKey: 'created_by' });
	Bed.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Bed, { as: 'deleted_by_beds', foreignKey: 'deleted_by' });
	Bed.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Bed, { as: 'updated_by_beds', foreignKey: 'updated_by' });
	Building.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Building, { as: 'buildings', foreignKey: 'created_by' });
	Building.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Building, { as: 'deleted_by_buildings', foreignKey: 'deleted_by' });
	Building.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Building, { as: 'updated_by_buildings', foreignKey: 'updated_by' });
	ContractFile.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(ContractFile, { as: 'contract_files', foreignKey: 'created_by' });
	ContractFile.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(ContractFile, { as: 'deleted_by_contract_files', foreignKey: 'deleted_by' });
	ContractFile.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(ContractFile, { as: 'updated_by_contract_files', foreignKey: 'updated_by' });
	ContractType.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(ContractType, { as: 'contract_types', foreignKey: 'created_by' });
	ContractType.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(ContractType, { as: 'deleted_by_contract_types', foreignKey: 'deleted_by' });
	ContractType.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(ContractType, { as: 'updated_by_contract_types', foreignKey: 'updated_by' });
	Contract.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Contract, { as: 'contracts', foreignKey: 'created_by' });
	Contract.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Contract, { as: 'deleted_by_contracts', foreignKey: 'deleted_by' });
	Contract.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Contract, { as: 'updated_by_contracts', foreignKey: 'updated_by' });
	EmailVerifyToken.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(EmailVerifyToken, { as: 'email_verify_tokens', foreignKey: 'user_id' });
	File.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(File, { as: 'files', foreignKey: 'created_by' });
	File.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(File, { as: 'deleted_by_files', foreignKey: 'deleted_by' });
	File.belongsTo(User, { as: 'owner_user', foreignKey: 'owner_user_id' });
	User.hasMany(File, { as: 'owner_user_files', foreignKey: 'owner_user_id' });
	File.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(File, { as: 'updated_by_files', foreignKey: 'updated_by' });
	IncidentFile.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(IncidentFile, { as: 'incident_files', foreignKey: 'created_by' });
	IncidentFile.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(IncidentFile, { as: 'deleted_by_incident_files', foreignKey: 'deleted_by' });
	IncidentFile.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(IncidentFile, { as: 'updated_by_incident_files', foreignKey: 'updated_by' });
	IncidentType.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(IncidentType, { as: 'incident_types', foreignKey: 'created_by' });
	IncidentType.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(IncidentType, { as: 'deleted_by_incident_types', foreignKey: 'deleted_by' });
	IncidentType.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(IncidentType, { as: 'updated_by_incident_types', foreignKey: 'updated_by' });
	Incident.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Incident, { as: 'incidents', foreignKey: 'created_by' });
	Incident.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Incident, { as: 'deleted_by_incidents', foreignKey: 'deleted_by' });
	Incident.belongsTo(User, { as: 'reporter', foreignKey: 'reporter_id' });
	User.hasMany(Incident, { as: 'reporter_incidents', foreignKey: 'reporter_id' });
	Incident.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Incident, { as: 'updated_by_incidents', foreignKey: 'updated_by' });
	NotificationDevice.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(NotificationDevice, { as: 'notification_devices', foreignKey: 'user_id' });
	NotificationPreference.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(NotificationPreference, { as: 'notification_preferences', foreignKey: 'user_id' });
	NotificationReceipt.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(NotificationReceipt, { as: 'notification_receipts', foreignKey: 'user_id' });
	NotificationTemplate.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(NotificationTemplate, { as: 'notification_templates', foreignKey: 'created_by' });
	NotificationTemplate.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(NotificationTemplate, { as: 'updated_by_notification_templates', foreignKey: 'updated_by' });
	PasswordResetToken.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(PasswordResetToken, { as: 'password_reset_tokens', foreignKey: 'user_id' });
	Permission.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Permission, { as: 'permissions', foreignKey: 'created_by' });
	Permission.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Permission, { as: 'updated_by_permissions', foreignKey: 'updated_by' });
	Post.belongsTo(User, { as: 'author', foreignKey: 'author_id' });
	User.hasMany(Post, { as: 'posts', foreignKey: 'author_id' });
	Post.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Post, { as: 'created_by_posts', foreignKey: 'created_by' });
	Post.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Post, { as: 'deleted_by_posts', foreignKey: 'deleted_by' });
	Post.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Post, { as: 'updated_by_posts', foreignKey: 'updated_by' });
	ResidentDocument.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(ResidentDocument, { as: 'resident_documents', foreignKey: 'created_by' });
	ResidentDocument.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(ResidentDocument, { as: 'deleted_by_resident_documents', foreignKey: 'deleted_by' });
	ResidentDocument.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(ResidentDocument, { as: 'updated_by_resident_documents', foreignKey: 'updated_by' });
	ResidentDocument.belongsTo(User, { as: 'verified_by_user', foreignKey: 'verified_by' });
	User.hasMany(ResidentDocument, { as: 'verified_by_resident_documents', foreignKey: 'verified_by' });
	ResidentEvent.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(ResidentEvent, { as: 'resident_events', foreignKey: 'created_by' });
	ResidentStay.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(ResidentStay, { as: 'resident_stays', foreignKey: 'created_by' });
	ResidentStay.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(ResidentStay, { as: 'updated_by_resident_stays', foreignKey: 'updated_by' });
	Resident.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Resident, { as: 'residents', foreignKey: 'created_by' });
	Resident.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Resident, { as: 'deleted_by_residents', foreignKey: 'deleted_by' });
	Resident.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Resident, { as: 'updated_by_residents', foreignKey: 'updated_by' });
	Resident.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasOne(Resident, { as: 'user_resident', foreignKey: 'user_id' });
	RolePermission.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(RolePermission, { as: 'role_permissions', foreignKey: 'created_by' });
	RolePermission.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(RolePermission, { as: 'updated_by_role_permissions', foreignKey: 'updated_by' });
	Role.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Role, { as: 'roles', foreignKey: 'created_by' });
	Role.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Role, { as: 'updated_by_roles', foreignKey: 'updated_by' });
	Room.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Room, { as: 'rooms', foreignKey: 'created_by' });
	Room.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Room, { as: 'deleted_by_rooms', foreignKey: 'deleted_by' });
	Room.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Room, { as: 'updated_by_rooms', foreignKey: 'updated_by' });
	Technician.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(Technician, { as: 'technicians', foreignKey: 'created_by' });
	Technician.belongsTo(User, { as: 'deleted_by_user', foreignKey: 'deleted_by' });
	User.hasMany(Technician, { as: 'deleted_by_technicians', foreignKey: 'deleted_by' });
	Technician.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(Technician, { as: 'updated_by_technicians', foreignKey: 'updated_by' });
	Technician.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(Technician, { as: 'user_technicians', foreignKey: 'user_id' });
	UserAuth.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasOne(UserAuth, { as: 'user_auth', foreignKey: 'user_id' });
	UserPasswordHistory.belongsTo(User, { as: 'changed_by_user', foreignKey: 'changed_by' });
	User.hasMany(UserPasswordHistory, { as: 'user_password_histories', foreignKey: 'changed_by' });
	UserPasswordHistory.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(UserPasswordHistory, { as: 'user_user_password_histories', foreignKey: 'user_id' });
	UserRole.belongsTo(User, { as: 'assigned_by_user', foreignKey: 'assigned_by' });
	User.hasMany(UserRole, { as: 'user_roles', foreignKey: 'assigned_by' });
	UserRole.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(UserRole, { as: 'created_by_user_roles', foreignKey: 'created_by' });
	UserRole.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(UserRole, { as: 'updated_by_user_roles', foreignKey: 'updated_by' });
	UserRole.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(UserRole, { as: 'user_user_roles', foreignKey: 'user_id' });
	UserSession.belongsTo(User, { as: 'user', foreignKey: 'user_id' });
	User.hasMany(UserSession, { as: 'user_sessions', foreignKey: 'user_id' });
	User.belongsTo(User, { as: 'created_by_user', foreignKey: 'created_by' });
	User.hasMany(User, { as: 'users', foreignKey: 'created_by' });
	User.belongsTo(User, { as: 'updated_by_user', foreignKey: 'updated_by' });
	User.hasMany(User, { as: 'updated_by_users', foreignKey: 'updated_by' });

	return {
		ActiveApartment: ActiveApartment,
		ActiveBed: ActiveBed,
		ActiveBuilding: ActiveBuilding,
		ActiveResidentStay: ActiveResidentStay,
		ActiveResident: ActiveResident,
		ActiveRoom: ActiveRoom,
		ActiveUser: ActiveUser,
		Apartment: Apartment,
		AuditDeadLetter: AuditDeadLetter,
		AuditOutbox: AuditOutbox,
		AuthAuditLog: AuthAuditLog,
		AuthAuditLogsDefault: AuthAuditLogsDefault,
		Bed: Bed,
		BillItem: BillItem,
		Bill: Bill,
		Building: Building,
		Client: Client,
		ContractFile: ContractFile,
		ContractType: ContractType,
		Contract: Contract,
		DebtReminderPolicy: DebtReminderPolicy,
		DebtReminderPolicyTarget: DebtReminderPolicyTarget,
		EmailVerifyToken: EmailVerifyToken,
		EntityChangeLog: EntityChangeLog,
		EntityChangeLogsDefault: EntityChangeLogsDefault,
		FileVariant: FileVariant,
		File: File,
		IncidentFile: IncidentFile,
		IncidentType: IncidentType,
		Incident: Incident,
		NotificationDeliveryAttempt: NotificationDeliveryAttempt,
		NotificationDevice: NotificationDevice,
		NotificationMessage: NotificationMessage,
		NotificationPreference: NotificationPreference,
		NotificationReceipt: NotificationReceipt,
		NotificationTemplate: NotificationTemplate,
		PasswordResetToken: PasswordResetToken,
		Permission: Permission,
		PostTarget: PostTarget,
		Post: Post,
		RefreshTokenAuditLog: RefreshTokenAuditLog,
		RefreshTokenAuditLogsDefault: RefreshTokenAuditLogsDefault,
		ResidentCurrentLocation: ResidentCurrentLocation,
		ResidentDocument: ResidentDocument,
		ResidentEvent: ResidentEvent,
		ResidentStay: ResidentStay,
		Resident: Resident,
		RolePermission: RolePermission,
		Role: Role,
		Room: Room,
		SchemaMigration: SchemaMigration,
		SystemAuditLog: SystemAuditLog,
		SystemAuditLogsDefault: SystemAuditLogsDefault,
		SystemConfig: SystemConfig,
		Technician: Technician,
		UserAuth: UserAuth,
		UserPasswordHistory: UserPasswordHistory,
		UserRoleDetail: UserRoleDetail,
		UserRole: UserRole,
		UserSession: UserSession,
		UserSessionsDetailed: UserSessionsDetailed,
		User: User,
		WebhookLog: WebhookLog,
	};
}
