# File model

The file model represents objects that will be saved in YAML file.

There are two types of file models:

* Saving everything to one file (SingleFile annotation)
* Saving one object to one file (ManyFiles annotation )

Every file model must have IdSection annotation on Id field.

The field which is annotated IdSection annotation is a unique key in YAML file, which represents one object. It is a primary section of an object in YAML file.

Saving, and updating YAML files system is based on Bukkit serialization.

{% embed url="<https://www.spigotmc.org/threads/tutorial-bukkit-custom-serialization.148781/>" %}

Every file model must be registered in the main class.

```java
ConfigurationSerialization.registerClass(UserCoins.class); //without alias
ConfigurationSerialization.registerClass(UserCoins.class, "UserCoins"); //with alias 
```

{% hint style="info" %}
In the file model constructor must be called init method.
{% endhint %}

File model methods:

```java
ConfigurationFile getConfigurationFile(); //gets information about file
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://timsixths-plugins.gitbook.io/minigameapi-docs/minigameapi-1.x/basic-features/models/file-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
