1: <?php declare( strict_types = 1 );
2:
3: namespace Waves\Model;
4:
5: use Waves\Account\Address;
6: use Waves\Common\JsonBase;
7: use Waves\Transactions\Recipient;
8:
9: class LeaseInfo extends JsonBase
10: {
11: function id(): Id { return $this->json->get( 'id' )->asId(); }
12: function originTransactionId(): Id { return $this->json->get( 'originTransactionId' )->asId(); }
13: function sender(): Address { return $this->json->get( 'sender' )->asAddress(); }
14: function recipient(): Recipient { return $this->json->get( 'recipient' )->asRecipient(); }
15: function amount(): int { return $this->json->get( 'amount' )->asInt(); }
16: function height(): int { return $this->json->get( 'height' )->asInt(); }
17: function status(): int
18: {
19: $status = $this->json->getOr( 'status', LeaseStatus::UNKNOWN_S )->asString();
20: switch( $status )
21: {
22: case LeaseStatus::ACTIVE_S: return LeaseStatus::ACTIVE;
23: case LeaseStatus::CANCELED_S: return LeaseStatus::CANCELED;
24: default: return LeaseStatus::UNKNOWN;
25: }
26: }
27: function cancelHeight(): int { return $this->json->get( 'cancelHeight' )->asInt(); }
28: function cancelTransactionId(): Id { return $this->json->get( 'cancelTransactionId' )->asId(); }
29: }
30: