<?php
namespace boru\ai\Asset;

class ProviderAssetBinding
{
    /** @var string|null */
    protected $id;

    /** @var string|null */
    protected $assetId;

    /** @var string|null */
    protected $provider;

    /** @var string|null */
    protected $providerAssetId;

    /** @var string|null */
    protected $providerUri;

    /** @var string|null */
    protected $purpose;

    /** @var string|null */
    protected $status;

    /** @var string|null */
    protected $mimeType;

    /** @var array */
    protected $metadata = array();

    /** @var mixed */
    protected $raw;

    /** @var string|null */
    protected $createdAt;

    /** @var string|null */
    protected $updatedAt;

    public function id($value = null)
    {
        if ($value !== null) {
            $this->id = (string)$value;
            return $this;
        }
        return $this->id;
    }

    public function assetId($value = null)
    {
        if ($value !== null) {
            $this->assetId = (string)$value;
            return $this;
        }
        return $this->assetId;
    }

    public function provider($value = null)
    {
        if ($value !== null) {
            $this->provider = (string)$value;
            return $this;
        }
        return $this->provider;
    }

    public function providerAssetId($value = null)
    {
        if ($value !== null) {
            $this->providerAssetId = (string)$value;
            return $this;
        }
        return $this->providerAssetId;
    }

    public function providerUri($value = null)
    {
        if ($value !== null) {
            $this->providerUri = (string)$value;
            return $this;
        }
        return $this->providerUri;
    }

    public function purpose($value = null)
    {
        if ($value !== null) {
            $this->purpose = (string)$value;
            return $this;
        }
        return $this->purpose;
    }

    public function status($value = null)
    {
        if ($value !== null) {
            $this->status = (string)$value;
            return $this;
        }
        return $this->status;
    }

    public function mimeType($value = null)
    {
        if ($value !== null) {
            $this->mimeType = (string)$value;
            return $this;
        }
        return $this->mimeType;
    }

    public function metadata($key = null, $value = null)
    {
        if ($key === null) {
            return $this->metadata;
        }
        if (is_array($key)) {
            $this->metadata = $key;
            return $this;
        }
        if (func_num_args() > 1) {
            $this->metadata[$key] = $value;
            return $this;
        }
        return isset($this->metadata[$key]) ? $this->metadata[$key] : null;
    }

    public function raw($value = null)
    {
        if (func_num_args() > 0) {
            $this->raw = $value;
            return $this;
        }
        return $this->raw;
    }

    public function createdAt($value = null)
    {
        if ($value !== null) {
            $this->createdAt = (string)$value;
            return $this;
        }
        return $this->createdAt;
    }

    public function updatedAt($value = null)
    {
        if ($value !== null) {
            $this->updatedAt = (string)$value;
            return $this;
        }
        return $this->updatedAt;
    }

    public function toArray()
    {
        return array(
            'id' => $this->id(),
            'asset_id' => $this->assetId(),
            'provider' => $this->provider(),
            'provider_asset_id' => $this->providerAssetId(),
            'provider_uri' => $this->providerUri(),
            'purpose' => $this->purpose(),
            'status' => $this->status(),
            'mime_type' => $this->mimeType(),
            'metadata' => $this->metadata(),
            'raw' => $this->raw(),
            'created_at' => $this->createdAt(),
            'updated_at' => $this->updatedAt(),
        );
    }
}
