<?php
declare(strict_types=1);

namespace FreshCloud\Mail\MimeContent;

final class MimeContentBuilder
{
    private string $type = '';
    private string $subtype = '';
    private string $charset = 'utf-8';
    private string $encoding = '7bit';
    private string $body = '';
    private ?string $raw = null;

    public function type(string $type): self
    {
        $this->type = $type;
        return $this;
    }

    public function subtype(string $subtype): self
    {
        $this->subtype = $subtype;
        return $this;
    }

    public function charset(string $charset): self
    {
        $this->charset = $charset;
        return $this;
    }

    public function encoding(string $encoding): self
    {
        $this->encoding = $encoding;
        return $this;
    }

    public function body(string $body): self
    {
        $this->body = $body;
        return $this;
    }

    public function build(): MimeContent
    {
        return new MimeContent(
            type: $this->type,
            subtype: $this->subtype,
            charset: $this->charset,
            encoding: $this->encoding,
            body: $this->body,
            raw: $this->raw
        );
    }
}