"""! @brief Defines the model class to handle type of client."""
##
# @file BTypeModel.py
#
# @brief Defines the BTypeModel class.
#
# @section description_businesstypemodel Description
# Defines the model class to handle CRUD operations on customers types.
# - BTypeModel (Model class)
#
# @section libraries_businesstypemodel Libraries/Modules
# - QAbstractListModel PySid6 core Class
# - Provides an abstract model that can be subclassed to create one-dimensional list models.
# - QModelIndex PySid6 core Class
# - Used to locate data in a data model.
# - Slot PySide6 function
# - A function that is called in response to a particular signal.
# - Qt PySid6 core Class
# - A namespace contains miscellaneous identifiers used throughout the Qt library.
# - BTypeDAO Local class
# - Defines the low-lever DAO class to handle CRUD operations on customers types.
#
# @section notes_businesstypemodel Notes
# - None.
#
# @section todo_businesstypemodel TODO
# - None.
#
# @section author_businesstypemodel Author(s)
# - Created by Linuxero on 03/14/2025.
# - Modified by Linuxero on 03/14/2025.
#
# Copyright (c) 2025 Schnaxero. All rights reserved.
from PySide6.QtCore import QAbstractListModel, Qt, QModelIndex
from .BTypeDAO import BTypeDAO
class BTypeModel(QAbstractListModel):
"""! The BTypeModel class.
Defines a model class utilized to handle data.
Inherits from QAbstractListModel
Handles the customers types data operations.
"""
def __init__(self):
"""! The AddressModel class initializer.
"""
super().__init__()
self.__btype_data = BTypeDAO().getBType()
def rowCount(self, parent = QModelIndex()):
"""! Returns the number of rows under the given parent.
Ref. rowCount()
"""
return len(self.__btype_data)
def data(self, index, role = Qt.DisplayRole):
"""! Returns the data stored under the given role for the item referred to by the index.
Ref. data()
"""
row = index.row()
if role == Qt.DisplayRole:
data= self.__btype_data[row][1]
return data
return None