interface PostInterface {
    id?: number;
    postType: string;
    code: string;
    authorId: number;
    accountId: number | null;
    lastUpdatedBy?: number | null;
    isRevision?: Boolean;
    revisionId?: number;
    status: string;
    visibility: string;
    isExclusive: boolean;
    publishedAt?: Date | null;
    isFeatured: boolean;
    sortOrder?: number;
    postContent?: PostContentInterface,
    postContents?: PostContentInterface[];
    wpPostId?: number | null;
}

interface PostContentInterface {
    id?: number;
    postId?: number;
    languageId: number;
    title: string;
    description: Text;
    descriptionText: Text;
    exerpt: Text | null;
    limitedContent?: Text | null;
    metaTitle?: string | null;
    metaDescription?: string | null;
    metaKeywords?: string | null;
    canonicalUrl?: string | null;
}

interface PostAuthorResponseInterface {
    id?: number;
    name: string;
    code: string | null;
    description?: Text;
    descriptionText?: Text;
}

interface postCategoryObjectRefInterface {
    id: number;
    code: string;
    name: string;
}

interface PostObjectInteface {
    id: number;
    postType: string;
    code: string;
    isRevision?: Boolean;
    revisionId?: number;
    status?: string | null;
    visibility?: string;
    isExclusive?: boolean;
    publishedAt?: Date | null;
    isFeatured: boolean;
    title: string;
    description: Text | null,
    descriptionText: Text | null,
    limitedContent?: Text | null,
    exerpt: Text | null;
    comments?: CommentPaginatedList;
    commentsCount?: number;
    postCategories?: postCategoryObjectRefInterface[];
    postAttachments: fileObject[] | null;
    featuredImge: fileObject | null;
    author: UserPublicObjectInterface | null;
    lastUpdatedBy?: UserPublicObjectInterface | null,
    wpPostId?: number | null;
}

interface PostObjectSummaryInteface {
    id: number;
    postType: string;
    code: string;
    isRevision?: Boolean;
    revisionId?: number;
    status?: string | null;
    visibility?: string;
    isExclusive?: boolean;
    publishedAt?: Date | null;
    isFeatured: boolean;
    title: string;
    description: Text | null,
    descriptionText: Text | null,
    limitedContent?: Text | null,
    exerpt: Text | null;
    featuredImge: fileObject | null;
    comments?: CommentPaginatedList;
    commentsCount?: number;
    wpPostId?: number | null;
}

interface PostRequestObject {
    postType: string;
    categoryIds: number[] | null;
    authorId?: number | null;
    title: string;
    description?: Text | null;
    limitedContent?: Text | null;
    exerpt: Text | null;
    isFeatured: boolean;
    status: string | null;
    visibility: string;
    isExclusive: boolean;
    publishedAt?: Date | null;
    postAttachmentIds: number[] | null;
    featuredImageId: number | null;
    tags: (number | string)[] | null;
    metaTitle?: string | null;
    metaDescription?: string | null;
    metaKeywords?: string | null;
    canonicalUrl?: string | null;
    wpPostId?: number | null;
}

interface PostObject {
    code?: string;
    status?: string | null;
    visibility?: string;
    isExclusive?: boolean;
    publishedAt?: Date | null;
    postType: string;
    isFeatured: boolean;
    authorId?: number;
    wpPostId?: number | null;
}

interface PostContentObject {
    id?: number;
    postId?: number;
    languageId?: number;
    title: string;
    description?: Text | null;
    descriptionText?: Text | null;
    exerpt: Text | null;
    limitedContent?: Text | null;
    metaTitle?: string | null;
    metaDescription?: string | null;
    metaKeywords?: string | null;
    canonicalUrl?: string | null;
}

interface PostDataObject {
    code?: string;
    postType: string;
    isFeatured: boolean;
    authorId: number | null;
    accountId: number | null;
    lastUpdatedBy?: number | null;
    status?: string | null;
    visibility?: string;
    isExclusive?: boolean;
    publishedAt?: Date | null;
    postContents?: PostContentObject[];
    postContent?: PostContentObject;
    wpPostId?: number | null;
}

interface PostIdentifierObject {
    id: number;
    postType: string;
}

interface PostStringIdentifierObject {
    code: string;
    postType: string;
}

interface PostTypeIdentifierObject {
    postType: string;
}

interface PostListRequestObject {
    page: number;
    perPage: number;
    sortBy: string;
    sortDirection: string;
    searchText: string | null;
    status: string | null;
    visibility?: string | null;
    isExclusive?: boolean | null;
    isPremium: boolean | null;
    postTagsIds: number[] | null;
    types: string[] | null;
    tags: number[] | null;
    categoryId: number | null;
    categories?: number[] | null;
    userId: number | null;
}

interface PostCategoryInterface {
    id: number;
    categoryId: number;
    postId: number;
}

interface PostTagInterface {
    id: number;
    categoryId: number;
    postId: number;
}

interface PostListPublicRequestObject {
    page: number;
    perPage: number;
    sortBy: string;
    sortDirection: string;
    searchText: string | null;
    status: string | null;
    postType: string | null;
    isPremium: boolean | null;
    categoryId: number | null;
    categories?: number[] | null;
}

// Alias for use in public listing APIs
type PostPublicListRequestObject = PostListPublicRequestObject;

interface PostListAllRequestObject {
    sortBy: string;
    sortDirection: string;
    searchText: string | null;
    status: string | null;
    categoryId: number | null;
    categories?: number[] | null;
}

interface PostPaginatedList {
    page: number;
    perPage: number;
    totalRecords: number;
    totalPages?: number;
    data: PostObjectSummaryInteface[] | [];
}

interface PostPaginatedData {
    count: number;
    rows: PostObjectSummaryInteface[] | []
}

interface PostSortRequest {
    before: number | null;
    after: number | null;
}

interface PostStatusObject {
    status: string;
}

interface PostAttachmentInterface {
    postId?: number;
    attachmentId: number | null;
    isFeatured: boolean
}

interface postTagsObject {
    id: number;
    postTags: postTagObject[];
}

interface postTagObject {
    id: number;
    code: string;
    name: string;
}

interface DaoOptions {
    transaction?: import("sequelize").Transaction;
}

interface PostGenerateTagIdsServiceInput {
    tags: (string | number)[];
}

interface PostCreateServiceInput {
    code?: string;
    postType: string;
    authorId: number;
    categoryIds: number[] | null;
    title: string;
    description?: Text | null;
    limitedContent?: Text | null;
    exerpt: Text | null;
    isFeatured: boolean;
    status: string | null;
    visibility: string;
    isExclusive: boolean;
    publishedAt?: Date | null;
    postAttachmentIds: number[] | null;
    featuredImageId: number | null;
    tags: (number | string)[] | null;
    metaTitle?: string | null;
    metaDescription?: string | null;
    metaKeywords?: string | null;
    canonicalUrl?: string | null;
    wpPostId?: number | null;
}

interface PostUpdateServiceInput {
    id: number;
    authorId: number;
    postType: string;
    categoryIds: number[] | null;
    title: string;
    description?: Text | null;
    limitedContent?: Text | null;
    exerpt: Text | null;
    isFeatured: boolean;
    status?: string | null;
    visibility?: string;
    isExclusive?: boolean;
    publishedAt?: Date | null;
    postAttachmentIds: number[] | null;
    featuredImageId: number | null;
    tags: (number | string)[] | null;
    metaTitle?: string | null;
    metaDescription?: string | null;
    metaKeywords?: string | null;
    canonicalUrl?: string | null;
    wpPostId?: number | null;
}

interface PostDeleteServiceInput {
    id: number;
    postType: string;
}

interface PostGetByIdServiceInput {
    id: number;
    postType: string;
    fullInfo?: boolean;
}

interface PostPublicGetByIdServiceInput {
    id: number;
    postType?: string;
    fullInfo?: boolean;
}

interface PostGetByCodeServiceInput {
    code: string;
    postType: string;
    fullInfo?: boolean;
}

interface PostGetPostsServiceInput {
    postType: string;
    listRequest: PostListRequestObject;
}

interface PostGetPostsByTagsServiceInput {
    listRequest: PostListRequestObject;
}

interface PostGetAllPostsServiceInput {
    postType: string;
    listRequest: PostListAllRequestObject;
}

interface PostGetPostRevisionsServiceInput {
    id: number;
    postType: string;
    listRequest: PostListRequestObject;
}

interface PostRestoreRevisionServiceInput {
    id: number;
    postType: string;
}

interface PostSetSortOrderServiceInput {
    id: number;
    postType: string;
    before: number | null;
    after: number | null;
}

interface PostUpdateStatusServiceInput {
    id: number;
    postType: string;
    status: string;
}

interface PostGetCategoryIdServiceInput {
    categoryCode: string;
}

interface PostGetPublicPostByCodeServiceInput {
    code: string;
    fullInfo?: boolean;
}

interface PostSetSortOrderDaoInput {
    id: number;
    postType: string;
    before?: number | null;
    after?: number | null;
}

interface PostGetPostDaoInput {
    id?: number | null;
    code?: string | null;
    accountId?: number | null;
    postType: string;
    language: string;
    expanded?: boolean;
    paranoid?: boolean;
    trackRecord?: boolean;
}

interface PostGetByIdDaoInput {
    id: number;
    postType: string;
    expanded?: boolean;
    paranoid?: boolean;
    trackIncludes?: boolean;
}

interface PostGetByCodeDaoInput {
    code: string;
    postType: string;
    expanded?: boolean;
    paranoid?: boolean;
}

interface PostDoExistsByCodeDaoInput {
    code: string;
    postType: string;
    excludeId?: number | null;
    includeRevision?: boolean;
}

interface PostDoExistsByIdDaoInput {
    id: number;
    postType?: string;
    includeRevision?: boolean;
}

interface PostCreateDaoInput {
    postObj: PostObject;
    postContentObj: PostContentObject;
    postAttachments: number[] | null;
    featuredImageId: number | null;
    languages: LanguageInfo;
    postTagsIds: number[] | null;
    postCategoriesIds: number[] | null;
}

interface PostUpdateDaoInput {
    id: number;
    postObj: PostObject;
    postContentObj: PostContentObject;
    postAttachments: number[] | null;
    featuredImageId: number | null;
    languages: LanguageInfo;
    postTagsIds: number[] | null;
    postCategoriesIds: number[] | null;
}

interface PostDeleteDaoInput {
    id: number;
    postType: string;
}

interface PostGetPostListDaoInput {
    postType: string;
    listRequest: PostListRequestObject;
}

interface PostGetPostByTagsDaoInput {
    listRequest: PostListRequestObject;
}

interface PostGetAllPostDaoInput {
    postType: string;
    listRequest: PostListAllRequestObject;
}

interface PostGetPostRevisionListDaoInput {
    id: number;
    postType: string;
    listRequest: PostListRequestObject;
}

interface PostRestoreRevisionDaoInput {
    id: number;
    postType: string;
}

interface PostStoreRevisionDaoInput {
    id: number;
}

interface PostUpdateStatusDaoInput {
    id: number;
    postType: string;
    status: string;
}

interface PostGetPublicPostByCodeDaoInput {
    code: string;
    expanded?: boolean;
    paranoid?: boolean;
}

interface PostGetPublicPostListDaoInput {
    listRequest: PostPublicListRequestObject;
}

interface PostGetPublicPostListServiceInput {
    listRequest: PostPublicListRequestObject;
}
