Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * Availability Status Logic Interface
5 *
6 * PHP version 8
7 *
8 * Copyright (C) The National Library of Finland 2024.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2,
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 *
23 * @category VuFind
24 * @package  ILS_Logic
25 * @author   Ere Maijala <ere.maijala@helsinki.fi>
26 * @author   Thomas Wagener <wagener@hebis.uni-frankfurt.de>
27 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
28 * @link     https://vufind.org/wiki/development Wiki
29 */
30
31namespace VuFind\ILS\Logic;
32
33/**
34 * Availability Status Logic Interface
35 *
36 * @category VuFind
37 * @package  ILS_Logic
38 * @author   Ere Maijala <ere.maijala@helsinki.fi>
39 * @author   Thomas Wagener <wagener@hebis.uni-frankfurt.de>
40 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
41 * @link     https://vufind.org/wiki/development Wiki
42 */
43interface AvailabilityStatusInterface
44{
45    /**
46     * Status code for unavailable items
47     *
48     * @var int
49     */
50    public const STATUS_UNAVAILABLE = 0;
51
52    /**
53     * Status code for available items
54     *
55     * @var int
56     */
57    public const STATUS_AVAILABLE = 1;
58
59    /**
60     * Status code for items with uncertain availability
61     *
62     * @var int
63     */
64    public const STATUS_UNCERTAIN = 2;
65
66    /**
67     * Status code for items where no status information is available
68     *
69     * @var int
70     */
71    public const STATUS_UNKNOWN = 3;
72
73    /**
74     * Check if available.
75     *
76     * @return bool
77     */
78    public function isAvailable(): bool;
79
80    /**
81     * Check if item has given availability status.
82     *
83     * @param int $availability Availability status
84     *
85     * @return bool
86     */
87    public function is(int $availability): bool;
88
89    /**
90     * Check if status should be visible.
91     *
92     * @return bool
93     */
94    public function isVisibleInHoldings(): bool;
95
96    /**
97     * Get status description.
98     *
99     * @return string
100     */
101    public function getStatusDescription(): string;
102
103    /**
104     * Get extra status information.
105     *
106     * @return array
107     */
108    public function getExtraStatusInformation(): array;
109
110    /**
111     * Get status description tokens. Used when status description is being translated.
112     *
113     * @return array
114     */
115    public function getStatusDescriptionTokens(): array;
116
117    /**
118     * Get schema.org availability URI.
119     *
120     * @return ?string
121     */
122    public function getSchemaAvailabilityUri(): ?string;
123
124    /**
125     * Convert availability to a string
126     *
127     * @return string
128     */
129    public function availabilityAsString(): string;
130
131    /**
132     * Compares priority with other availability status for acquiring overall status of multiple status.
133     *
134     * @param AvailabilityStatusInterface $other Other Availability Status
135     *
136     * @return int
137     */
138    public function compareTo(AvailabilityStatusInterface $other): int;
139}