# Rules

The file should be structured as follows.

- `conflict-resolution-rules` Required, document root element.

  - `policy` Required, contains the policies descriptions. For details on the node format, refer to the section Resolutions Description Format: Policies. The element content must reflect the conditions under which the conflicts were detected.

  - `rule`
    Optional, contains a rule description.
    Must be present in the document when defining conflict resolution rules. Should be present as many times as the number of unresolved conflicts.

    At least one of the attributes (`conflict-id`, `conflict-guid`) MUST be present.

    - `conflict-id` Optional, defines ID of the conflict being resolved. Value is integer. The ID should be obtained from the conflict description returned by `pleskrestore` (the “`/conflicts-description/conflict[@id]`” attribute value)

    - `conflict-guid` Optional, defines global ID of the conflict being resolved. Value is string. The GUID should be obtained from the conflict description returned by `pleskrestore` (the “`/conflicts-description/conflict[@guid]`” attribute value). If omitted, the conflict for resolution is identified by ID.

    - `dump-objects` Optional, holds a collection of descriptions of backup objects involved into the conflict and taking the same conflict resolution Must be present in the document in case when different objects involved in the same conflict should be resolved in different ways. May not be present in the document in case when all objects involved in the conflict should be resolved the same way. See the structure below.

    - `resolution` Required, contains definition of resolution for the conflict, see the structure below.

`dump-objects` structure:

- `node`
  Required, contains a description of backup object involved in the conflict.
  The element contents must be taken from the conflict description returned by `pleskrestore` (the “`/conflicts-description/conflict/conflicting-objects/node`” element).
  Structured as follows:

- `name` Required, specifies the object type, value must be a string.

- `context` Optional, holds a collection of data specifying the object position in backup.

  - `path` Required if the `context` element is present in the document, specifies the location of object definition in the backup metadata. Value must be a string conforming to the XPath notation.

- `attributes` Required, holds a collection of the object properties.

  - `attribute` Required, specifies a particular property of the object (e.g., login, ID, GUID, etc.), empty value.

    - `name` Required, specifies the property name, value must be a string.

    - `value` Required, specifies the property value, value must be a string.

`resolution` structure:

The `resolution` element must not be empty, it is required that it contains one, and only one of its children elements:

- `do-not-restore` Sets the Do Not Restore resolution for the conflict, empty value.

- `proceed-with-current` Sets the Proceed With Current resolution for the conflict, empty value.

- `automatic` Sets the Automatic resolution for the conflict, empty value.

- `overuse` Sets the Overuse resolution for the conflict, empty value.

- `overwrite` Sets the Overwrite resolution for the conflict, empty value.

- `rename` Sets the Rename resolution for the conflict, empty value.

  - `new-name` Required, specifies a name of unique resource that should be assigned to the conflicting objects, value must be a string. Makes sense only for unique resource usage conflicts (mapping of IP, database server, object owner).