import { Association, BelongsToGetAssociationMixin, BelongsToManyAddAssociationMixin, BelongsToManyCreateAssociationMixin, BelongsToManyGetAssociationsMixin, BelongsToManyRemoveAssociationMixin, BelongsToManySetAssociationsMixin, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, NonAttribute, Sequelize, sql } from "@sequelize/core";
import { Post } from "./Post";

import { SqliteDialect } from '@sequelize/sqlite3';
import { Attribute, AutoIncrement, BelongsTo, BelongsToMany, Default, NotNull, PrimaryKey, Unique } from "@sequelize/core/decorators-legacy";
import { Attachment } from "./Attachment";
import { UUID } from "crypto";

export class Bucket extends Model<InferAttributes<Bucket>, InferCreationAttributes<Bucket>> {
    @PrimaryKey
    @Unique
    @Attribute(DataTypes.UUIDV4)
    @Default(sql.uuidV4)
    declare id: UUID
    
    /** Defined by {@link Post.buckets} */
    declare posts?:NonAttribute<Post>[];
    

    /** Defined by {@link Attachment.bucket} */
    declare attachments?:NonAttribute<Attachment>[];

    declare static associations: {
        posts: Association<Post, Bucket>;
        attachments: Association<Attachment, Bucket>;
    };
}
