<?php

namespace GhostCrawl\Models;

use Microsoft\Kiota\Abstractions\Serialization\AdditionalDataHolder;
use Microsoft\Kiota\Abstractions\Serialization\Parsable;
use Microsoft\Kiota\Abstractions\Serialization\ParseNode;
use Microsoft\Kiota\Abstractions\Serialization\SerializationWriter;

/**
 * Response for GET /v1/webhooks (cursor-paginated list).
*/
class WebhookListResponse implements AdditionalDataHolder, Parsable 
{
    /**
     * @var array<string, mixed>|null $additionalData Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
    */
    private ?array $additionalData = null;
    
    /**
     * @var array<WebhookPublic>|null $items The items property
    */
    private ?array $items = null;
    
    /**
     * @var WebhookListResponse_next_cursor|null $next_cursor The next_cursor property
    */
    private ?WebhookListResponse_next_cursor $next_cursor = null;
    
    /**
     * @var int|null $total The total property
    */
    private ?int $total = null;
    
    /**
     * Instantiates a new WebhookListResponse and sets the default values.
    */
    public function __construct() {
        $this->setAdditionalData([]);
    }

    /**
     * Creates a new instance of the appropriate class based on discriminator value
     * @param ParseNode $parseNode The parse node to use to read the discriminator value and create the object
     * @return WebhookListResponse
    */
    public static function createFromDiscriminatorValue(ParseNode $parseNode): WebhookListResponse {
        return new WebhookListResponse();
    }

    /**
     * Gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
     * @return array<string, mixed>|null
    */
    public function getAdditionalData(): ?array {
        return $this->additionalData;
    }

    /**
     * The deserialization information for the current model
     * @return array<string, callable(ParseNode): void>
    */
    public function getFieldDeserializers(): array {
        $o = $this;
        return  [
            'items' => fn(ParseNode $n) => $o->setItems($n->getCollectionOfObjectValues([WebhookPublic::class, 'createFromDiscriminatorValue'])),
            'next_cursor' => fn(ParseNode $n) => $o->setNextCursor($n->getObjectValue([WebhookListResponse_next_cursor::class, 'createFromDiscriminatorValue'])),
            'total' => fn(ParseNode $n) => $o->setTotal($n->getIntegerValue()),
        ];
    }

    /**
     * Gets the items property value. The items property
     * @return array<WebhookPublic>|null
    */
    public function getItems(): ?array {
        return $this->items;
    }

    /**
     * Gets the next_cursor property value. The next_cursor property
     * @return WebhookListResponse_next_cursor|null
    */
    public function getNextCursor(): ?WebhookListResponse_next_cursor {
        return $this->next_cursor;
    }

    /**
     * Gets the total property value. The total property
     * @return int|null
    */
    public function getTotal(): ?int {
        return $this->total;
    }

    /**
     * Serializes information the current object
     * @param SerializationWriter $writer Serialization writer to use to serialize this model
    */
    public function serialize(SerializationWriter $writer): void {
        $writer->writeCollectionOfObjectValues('items', $this->getItems());
        $writer->writeObjectValue('next_cursor', $this->getNextCursor());
        $writer->writeIntegerValue('total', $this->getTotal());
        $writer->writeAdditionalData($this->getAdditionalData());
    }

    /**
     * Sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
     * @param array<string,mixed> $value Value to set for the AdditionalData property.
    */
    public function setAdditionalData(?array $value): void {
        $this->additionalData = $value;
    }

    /**
     * Sets the items property value. The items property
     * @param array<WebhookPublic>|null $value Value to set for the items property.
    */
    public function setItems(?array $value): void {
        $this->items = $value;
    }

    /**
     * Sets the next_cursor property value. The next_cursor property
     * @param WebhookListResponse_next_cursor|null $value Value to set for the next_cursor property.
    */
    public function setNextCursor(?WebhookListResponse_next_cursor $value): void {
        $this->next_cursor = $value;
    }

    /**
     * Sets the total property value. The total property
     * @param int|null $value Value to set for the total property.
    */
    public function setTotal(?int $value): void {
        $this->total = $value;
    }

}
