|
| 1 | +from abc import ABC, abstractmethod |
| 2 | +from .constants import * |
| 3 | + |
| 4 | + |
| 5 | +class Book(ABC): |
| 6 | + def __init__(self, ISBN, title, subject, publisher, language, number_of_pages): |
| 7 | + self.__ISBN = ISBN |
| 8 | + self.__title = title |
| 9 | + self.__subject = subject |
| 10 | + self.__publisher = publisher |
| 11 | + self.__language = language |
| 12 | + self.__number_of_pages = number_of_pages |
| 13 | + self.__authors = [] |
| 14 | + |
| 15 | + |
| 16 | +class BookItem(Book): |
| 17 | + def __init__(self, barcode, is_reference_only, borrowed, due_date, price, book_format, status, |
| 18 | + date_of_purchase, publication_date, placed_at): |
| 19 | + self.__barcode = barcode |
| 20 | + self.__is_reference_only = is_reference_only |
| 21 | + self.__borrowed = borrowed |
| 22 | + self.__due_date = due_date |
| 23 | + self.__price = price |
| 24 | + self.__format = book_format |
| 25 | + self.__status = status |
| 26 | + self.__date_of_purchase = date_of_purchase |
| 27 | + self.__publication_date = publication_date |
| 28 | + self.__placed_at = placed_at |
| 29 | + |
| 30 | + def checkout(self, member_id): |
| 31 | + if self.get_is_reference_only(): |
| 32 | + print("self book is Reference only and can't be issued") |
| 33 | + return False |
| 34 | + if not BookLending.lend_book(self.get_bar_code(), member_id): |
| 35 | + return False |
| 36 | + self.update_book_item_status(BookStatus.LOANED) |
| 37 | + return True |
| 38 | + |
| 39 | + |
| 40 | +class Rack: |
| 41 | + def __init__(self, number, location_identifier): |
| 42 | + self.__number = number |
| 43 | + self.__location_identifier = location_identifier |
| 44 | + |
| 45 | + |
| 46 | +class BookReservation: |
| 47 | + def __init__(self, creation_date, status, book_item_barcode, member_id): |
| 48 | + self.__creation_date = creation_date |
| 49 | + self.__status = status |
| 50 | + self.__book_item_barcode = book_item_barcode |
| 51 | + self.__member_id = member_id |
| 52 | + |
| 53 | + def fetch_reservation_details(self, barcode): |
| 54 | + None |
| 55 | + |
| 56 | + |
| 57 | +class BookLending: |
| 58 | + def __init__(self, creation_date, due_date, book_item_barcode, member_id): |
| 59 | + self.__creation_date = creation_date |
| 60 | + self.__due_date = due_date |
| 61 | + self.__return_date = None |
| 62 | + self.__book_item_barcode = book_item_barcode |
| 63 | + self.__member_id = member_id |
| 64 | + |
| 65 | + def lend_book(self, barcode, member_id): |
| 66 | + None |
| 67 | + |
| 68 | + def fetch_lending_details(self, barcode): |
| 69 | + None |
| 70 | + |
| 71 | + |
| 72 | +class Fine: |
| 73 | + def __init__(self, creation_date, book_item_barcode, member_id): |
| 74 | + self.__creation_date = creation_date |
| 75 | + self.__book_item_barcode = book_item_barcode |
| 76 | + self.__member_id = member_id |
| 77 | + |
| 78 | + def collect_fine(self, member_id, days): |
| 79 | + None |
| 80 | + |
0 commit comments