import { ListOptions, BasePort } from '@humand-packages/common';
import { FindUserOptions } from '../../../users/business/interfaces/findUserOptions';
import { User } from '../../../users/business/models/user';
import { UserInterface } from '../../../users/business/models/userInterface';
import { UserListAllFilters } from '../../../users/business/types/listAllFilters';
import { UserDAO } from '../../../users/infrastructure/dataAccessObjects/userDAO';

export abstract class UsersServicePort extends BasePort {
    abstract getUsers(
        loggedUser: UserInterface,
        filters: UserListAllFilters,
        { pagination, sortingOptions }: ListOptions,
        options?: FindUserOptions,
    ): Promise<{ count: number; rows: User[] }>;

    abstract getUserIds(loggedUser: UserInterface, filters: UserListAllFilters, hasManageCapability: boolean): Promise<number[]>;
    abstract getFilteredIds(loggedUser: UserInterface, filters: UserListAllFilters, options?: FindUserOptions): Promise<number[]>;
    abstract listAllByInstance(
        instanceId: number,
        filters: UserListAllFilters,
        { pagination, sortingOptions }: ListOptions,
        options?: FindUserOptions,
    ): Promise<{ count: number; rows: UserDAO[] }>;

    abstract getByIdOrFail(instanceId: number, id: number): Promise<UserDAO>;
    abstract getByIdOrNull(instanceId: number, id: number): Promise<UserDAO | null>;
    abstract getValidUsersByIds(instanceId: number, userIds: number[]): Promise<number[]>;
    abstract listUsers(
        loggedUser: UserDAO | UserInterface,
        filters: UserListAllFilters,
        { pagination, sortingOptions }: ListOptions,
        options?: FindUserOptions,
    ): Promise<{ count: number; rows: UserDAO[] }>;
}
