<?php

namespace App\Dto;

use App\Entity\Snip;

class SnipPostRequest
{
    public function __construct(
        public ?string $name = null,
        public ?string $content = null,
        public ?bool   $public = null,
        public ?bool   $visible = null,
    ) {}

    public function pushToSnip(Snip $snip): void
    {
        if ($this->name !== null) {
            $snip->setName($this->name);
        }
        if ($this->public !== null) {
            $snip->setPublic($this->public);
        }
        if ($this->visible !== null) {
            $snip->setVisible($this->visible);
        }
    }
}