<?php

namespace GemBoards\Entities;

use GemBoards\Classes\AbstractEntity;
use GemBoards\factories\FolderFactory;


class Folder extends AbstractEntity {

	protected string $table       = 'gemboards_folders';
	protected string $object_type = 'folder';

	protected array $data = [
		'project_id' => 0,
		'parent_id'  => null,
		'title'      => '',
		'is_private' => false,
		'created_at' => '',
		'updated_at' => '',
	];

	public static function factory(): FolderFactory {
		return FolderFactory::init();
	}

	public function get_project_id( string $context = 'view' ) {
		return (int) $this->get_prop( 'project_id', $context );
	}

	public function get_parent_id( string $context = 'view' ) {
		return $this->get_prop( 'parent_id', $context );
	}

	public function get_title( string $context = 'view' ) {
		return $this->get_prop( 'title', $context );
	}

	protected function get_is_private( string $context = 'view' ) {
		return $this->get_prop( 'is_private', $context );
	}

	public function is_private( string $context = 'view' ) {
		return $this->get_is_private( $context );
	}

	public function get_date_created( string $context = 'view' ) {
		return $this->get_prop( 'created_at', $context );
	}

	public function get_date_updated( string $context = 'view' ) {
		return $this->get_prop( 'updated_at', $context );
	}

	public function set_project_id( int $value ) {
		$this->set_prop( 'project_id', $value );
	}

	public function set_parent_id( ?int $value ) {
		$this->set_prop( 'parent_id', $value );
	}

	public function set_title( string $value ) {
		$this->set_prop( 'title', $value );
	}

	public function set_is_private( bool $value ) {
		$this->set_prop( 'is_private', $value );
	}

}
