@startuml IGenericRepository

package app {
    interface IGenericRepository<EntityType> {
        +GetList(ctx context.Context, orderBy string, orderDirection string, page int, size int, queryBuilder interfaces.IQueryBuilder) ([]EntityType, error)
        --
        +Count(ctx context.Context, queryBuilder interfaces.IQueryBuilder) (int64, error)
        --
        +NewQueryBuilder(ctx context.Context) interfaces.IQueryBuilder
        --
        +GetById(ctx context.Context, id uuid.UUID) (EntityType, error)
        --
        +Update(ctx context.Context, entity EntityType) (EntityType, error)
        --
        +Insert(ctx context.Context, entity EntityType) (EntityType, error)
        --
        +Delete(ctx context.Context, id uuid.UUID) error
        --
        +CloseDb() error
    }
    note left of IGenericRepository::GetList
      Get list of elements with filtering and pagination
    end note

    note left of IGenericRepository::Count
      Get count of entities with filtering
    end note

    note left of IGenericRepository::NewQueryBuilder
      Get new instance of the query builder
    end note

    note left of IGenericRepository::GetById
      Get entity by ID from repository
    end note

    note left of IGenericRepository::Update
      Save the changes to the existing entity in the repository
    end note

    note left of IGenericRepository::Insert
      Add entity to the repository
    end note

    note left of IGenericRepository::Delete
      Delete entity from the database
    end note

    note left of IGenericRepository::CloseDb
      Closes current database connection
    end note
}

@enduml
