<?php

declare(strict_types=1);

namespace CloudXM\NFe\DTOs;

/**
 * NFSe Data DTO
 * 
 * Represents NFSe-specific fields in v2 API response
 */
class NfseData
{
    public function __construct(
        public ?string $number = null,
        public ?string $series = null,
        public ?string $access_key = null,
        public ?string $protocol = null,
        public ?string $verification_code = null
    ) {}

    /**
     * Create from API response array
     */
    public static function fromArray(array $data): self
    {
        return new self(
            number: $data['number'] ?? null,
            series: $data['series'] ?? null,
            access_key: $data['access_key'] ?? null,
            protocol: $data['protocol'] ?? null,
            verification_code: $data['verification_code'] ?? null
        );
    }

    /**
     * Validate NFSe data
     * 
     * @return array Empty array if valid, array of errors if invalid
     */
    public function validate(): array
    {
        // All fields are optional
        // No specific validation rules for NFSe data
        return [];
    }
}
