<?php

namespace Limb_Chatbot\Includes\Widgets\Data;

class Start_Chat_Button_Widget_Config extends Abstract_Widget_Config {
	public function sanitize( $data ): array {
		$data = is_array( $data ) ? $data : [];

		return [
			'text'             => $this->sanitize_string( $data['text'] ?? '' ),
			'typing_indicator' => $this->sanitize_bool( $data['typing_indicator'] ?? true, true ),
		];
	}

	public function validate( $data ): bool {
		return is_array( $data );
	}

	public function get_translatable_fields(): array {
		return [
			[ 'path' => 'text', 'type' => 'string' ],
		];
	}
}
