<?php
namespace Phad;
class ItemInfo {
/** Set true to stop submission, even if it would otherwise proceed */
public bool $cancel_submit = false;
/** Array of property information as defined on a form. */
public array $properties;
public function __construct(
/** The name of the item node. `item="blog"` becomes `name="Blog"` */
public string $name,
/** One of Phad\Blocks class consts, indicating what operation to perform with this item (view,submit,delete, etc). TODO: Turn Phad\Blocks into an enum */
public int $mode = \Phad\Blocks::VIEW,
/** (I DONT KNOW) rawdata generally json. could be sql or csv though. TODO: document apis properly */
public array $apis = [],
/** either 'view' or 'form'. TODO: Make this an enum? or a bool 'is_form'? */
public string $type = 'view',
/** Arguments passed into compiled template. TODO: Maybe declare a `$phad` property on this class? */
public array $args = [],
/** indicates which data node retured data, or false if none or unprocessed */
public bool|int $data_index = false,
/** array of information from the `<p-data>` nodes. */
public array $data_nodes = [],
/** the final response code or false when uninitialized */
public bool|int $response_code = false, // could start as 500?
/** The actual data to display, as an array of rows (*will be converted into an object before displaying*) */
public array $rows = [], // could start null/false?
/** Array of error messages. TODO: Create an error class */
public array $errors = [],
/** Array of error messages related to submission. TODO: Create an error class */
public array $submit_errors = [],
/* access string for deletion, or true/false */
public bool|string $candelete=false,
/* function string to run when deletion was successful, or false */
public bool|string $diddelete=false,
/* access string to check if cansubmit, or true/false */
public bool|string $cansubmit=false,
/* The url path to redirect to after submission TODO: i think this is string, but not sure. */
public mixed $target=null,
) {
}
}