import {
	Association,
	CreationOptional,
	DataTypes,
	InferAttributes,
	InferCreationAttributes,
	Model,
	NonAttribute,
} from "@sequelize/core";
import {
	Attribute,
	AutoIncrement,
	PrimaryKey,
	Unique,
} from "@sequelize/core/decorators-legacy";
import { Post } from "./Post";
export class Project extends Model<
	InferAttributes<Project>,
	InferCreationAttributes<Project>
> {
	@Attribute(DataTypes.INTEGER)
	@PrimaryKey
	// @Unique
	@AutoIncrement
	declare id: CreationOptional<number>;
	@Attribute(DataTypes.STRING)
	@Unique
	declare readableIdentifier: string;
	@Attribute(DataTypes.STRING)
	declare name: string;
	/** Defined by {@link Post.project} */
	declare posts?: NonAttribute<Post>[];

	declare static associations: {
		posts: Association<Post, Project>;
	};
}
