|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Application\Api\Input; |
|
6
|
|
|
|
|
7
|
|
|
use Application\Enum\ExportFormat; |
|
8
|
|
|
use Application\Enum\Site; |
|
9
|
|
|
use Application\Model\Card; |
|
10
|
|
|
use Application\Model\Collection; |
|
11
|
|
|
use Ecodev\Felix\Api\Scalar\ColorType; |
|
12
|
|
|
use GraphQL\Type\Definition\InputObjectType; |
|
13
|
|
|
|
|
14
|
|
|
class CreateExportInputType extends InputObjectType |
|
15
|
|
|
{ |
|
16
|
2 |
|
public function __construct() |
|
17
|
|
|
{ |
|
18
|
|
|
// Here we use non-standard input to inject collections and cards for which we do not want setters in model |
|
19
|
1 |
|
$config = [ |
|
20
|
1 |
|
'description' => 'An export of cards in various format', |
|
21
|
1 |
|
'fields' => fn (): array => [ |
|
22
|
2 |
|
'format' => [ |
|
23
|
2 |
|
'type' => _types()->get(ExportFormat::class), |
|
24
|
2 |
|
'defaultValue' => ExportFormat::Zip, |
|
25
|
2 |
|
], |
|
26
|
2 |
|
'maxHeight' => [ |
|
27
|
2 |
|
'type' => self::int(), |
|
28
|
2 |
|
'defaultValue' => 0, |
|
29
|
2 |
|
], |
|
30
|
2 |
|
'includeLegend' => [ |
|
31
|
2 |
|
'type' => self::boolean(), |
|
32
|
2 |
|
'defaultValue' => true, |
|
33
|
2 |
|
], |
|
34
|
2 |
|
'textColor' => [ |
|
35
|
2 |
|
'type' => _types()->get(ColorType::class), |
|
36
|
2 |
|
'defaultValue' => '#FFFFFF', |
|
37
|
2 |
|
], |
|
38
|
2 |
|
'backgroundColor' => [ |
|
39
|
2 |
|
'type' => _types()->get(ColorType::class), |
|
40
|
2 |
|
'defaultValue' => '#000000', |
|
41
|
2 |
|
], |
|
42
|
2 |
|
'site' => [ |
|
43
|
2 |
|
'type' => self::nonNull(_types()->get(Site::class)), |
|
44
|
2 |
|
], |
|
45
|
2 |
|
'collections' => [ |
|
46
|
2 |
|
'type' => self::nonNull(self::listOf(self::nonNull(_types()->getId(Collection::class)))), |
|
47
|
2 |
|
'defaultValue' => [], |
|
48
|
2 |
|
], |
|
49
|
2 |
|
'cards' => [ |
|
50
|
2 |
|
'type' => self::nonNull(self::listOf(self::nonNull(_types()->getId(Card::class)))), |
|
51
|
2 |
|
'defaultValue' => [], |
|
52
|
2 |
|
], |
|
53
|
2 |
|
], |
|
54
|
1 |
|
]; |
|
55
|
|
|
|
|
56
|
1 |
|
parent::__construct($config); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|