# API Documentation: Creating an Advertisement

This document provides a guide on how marketplace database has been built. 




## Advertise
<img src="images/advertise-db-diragram.png"  width="50%">


- **advertises**: In this table the base data that is common for all kind of advertise will be stored, like title, slug, image, status, etc.
- **Advertise_metas**: This table contains any additional data that developers may find useful in the app development process. It functions as a key-value pair, providing flexibility in storing information. While not essential, it can enhance the app's functionality and user experience.
- **advertise_types**: In this table we define different kind of advertise.
  - name:  just for show 
  - parent_id: because data can have parent-child relationship [example](#advertise-type-data-example)
  - term_id: Term can act as Category and Tag in our system 
  - is_free: admin can define a price for submitting advertise and if it's free this field should be true
  - price:  The price customers should pay for submitting a advertise
  - image: an image for show
- **advertise_type_attributes**: storing data about fields that an advertise need. for example a an advertise about home need data like room, address, floor,size of the house and etc.
  - advertise_type_id: 
  - label: for show as title of input
  - type: input type can be text, number, select and other valid html input
  - name: should be a valid php value name. it can't start with number and other invalid character
  - default_value: 
  - is_required: it will be use in advertise form submission 
  - is_filterable: if the attribute well be use in filtering
  - filter_type: if "is_filterable" true this field should be valid html input  
  - is_price_effective: this field is  extra and for now is not functional
  - validation: this field is  extra and for now is not functional
- **advertise_type_attributes_items**: sometime can happen that an advertise attribute need more data like when you create color attribute you need to define the colors too like blue,red and etc, the extra data will be stored here
- **advertise_type_attributes_values**:when a customer create advertise the base information like title and description will be stores in **advertises** but the extra information that admins define as attributes need to be stored in this table like for category "Car" we store the brand and model of car here 

---

## Examples: 

#### advertise-type-data-example
<img src="images/advertise-type-data-example.png"  width="50%">
