<?php

/*
 * This file is part of the VITICORE2 package.
 *
 * (c) CP Creation <web@cpcreation.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CpCreation\VitiCore\Cart\Model;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\UuidInterface;

#[ORM\Entity(readOnly: true)]
#[ORM\Table(name: 'cart_legacy_order_import_run')]
#[ORM\UniqueConstraint(name: 'uniq_legacy_order_import_run_source', columns: ['source_key'])]
class LegacyOrderImportRun
{
    #[ORM\Id]
    #[ORM\Column(type: 'uuid')]
    private UuidInterface $id;

    #[ORM\Column(type: Types::STRING, length: 64)]
    private string $sourceKey;

    #[ORM\Column(type: Types::STRING, length: 255)]
    private string $sourceLabel;

    #[ORM\Column(type: Types::STRING, length: 16)]
    private string $scope;

    #[ORM\Column(type: Types::STRING, length: 16)]
    private string $status;

    #[ORM\Column(type: Types::INTEGER, options: ['default' => 1])]
    private int $attemptCount = 1;

    #[ORM\Column(type: Types::INTEGER, options: ['default' => 0])]
    private int $sourceCount = 0;

    #[ORM\Column(type: Types::INTEGER, options: ['default' => 0])]
    private int $importedCount = 0;

    #[ORM\Column(type: Types::INTEGER, options: ['default' => 0])]
    private int $skippedCount = 0;

    #[ORM\Column(type: Types::BIGINT, options: ['default' => 0])]
    private string $totalTtc = '0';

    /**
     * @var array<string, mixed>
     */
    #[ORM\Column(type: Types::JSON, options: ['jsonb' => true])]
    private array $report = [];

    #[ORM\Column(type: Types::DATETIME_MUTABLE)]
    private \DateTimeInterface $startedAt;

    #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
    private ?\DateTimeInterface $completedAt = null;
}
