<?php

namespace Alsendo\AlsendoWrapper\Model\Error;

class ApiErrorResponse
{
    /** @var bool Always false */
    public bool $success = false;

    /** @var int|null HTTP status code from API, null for pre-request errors */
    public ?int $statusCode;

    /** @var string|null General error message */
    public ?string $message;

    /** @var ErrorMessage[] Field-level errors */
    public array $errors;

    /**
     * @param string|null $message General error message
     * @param ErrorMessage[] $errors Field-level errors
     * @param int|null $statusCode HTTP status code
     */
    public function __construct(?string $message = null, array $errors = [], ?int $statusCode = null)
    {
        $this->message = $message;
        $this->errors = $errors;
        $this->statusCode = $statusCode;
    }
}
