/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import { Entity, Column, PrimaryColumn } from 'typeorm';
import { id } from './util/id.js';
import { MiUser } from './User.js';

@Entity('auto_removal_condition')
// @Index(['userId'], { unique: true })
export class MiAutoRemovalCondition {
	@PrimaryColumn({
		...id(),
		nullable: false,
	})
	public userId: MiUser['id'];

	@Column('bigint', {
		default: 7,
		nullable: false,
	})
	public deleteAfter: number;

	@Column('boolean', {
		default: true,
		nullable: false,
	})
	public noPiningNotes: boolean;

	@Column('boolean', {
		default: true,
		nullable: false,
	})
	public noSpecifiedNotes: boolean;

	constructor(data: Partial<MiAutoRemovalCondition>) {
		if (data == null) return;

		for (const [k, v] of Object.entries(data)) {
			(this as any)[k] = v;
		}
	}
}
