<?php

namespace attachments\helpers;

class attachment_relation
{
    public string $object_type; // Type of the object (e.g., 'users_o', 'orders_o', etc.)
    public int $object_id;      // ID of the object
    public function __construct(?object $options = null)
    {
        if ($options) {
            foreach ($options as $key => $value) {
                if (property_exists($this, $key)) {
                    $this->$key = $value;
                }
            }
        }
    }

    public function toArray(): array
    {
        return [
            'object_type' => $this->object_type,
            'object_id' => $this->object_id,
        ];
    }
}