<?php

namespace GemBoards\Entities;

use GemBoards\Classes\AbstractEntity;
use GemBoards\factories\ColumnFactory;


class Column extends AbstractEntity {

	protected string $table       = 'gemboards_columns';
	protected string $object_type = 'column';

	protected array $data = [
		'board_id'   => 0,
		'title'      => '',
		'slug'       => '',
		'color'      => null,
		'sort_order' => 1,
	];

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

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

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

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

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

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

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

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

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

	public function set_slug( $value ) {
		$this->set_prop( 'slug', $value );
	}

	public function set_color( $value ) {
		$this->set_prop( 'color', $value );
	}

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

}
