<?php

namespace App\DTOs\ProductOwner;

class ActivationResponseData
{
    public function __construct(
        public bool $success,
        public ?string $installationId = null,
        public ?string $activationToken = null,
        public ?string $apiSecret = null,
        public ?string $message = null,
        public ?string $expiresAt = null,
    ) {}

    public static function fromArray(array $data): self
    {
        return new self(
            success: (bool) ($data['success'] ?? false),
            installationId: $data['installation_id'] ?? null,
            activationToken: $data['activation_token'] ?? null,
            apiSecret: $data['api_secret'] ?? null,
            message: $data['message'] ?? null,
            expiresAt: $data['expires_at'] ?? null,
        );
    }
}
