# Territory

> An area or resource being managed.

Page: https://docs.icepack.ai/nvd/territory/

## Overview

A territory is analogous to a sales rep. It's typical to have sales reps positioned at different locations and as such, each could be considered to me managing a territory.

### Applicable models

* NVD `nvd-hap0j2y4zlm1`

## Territory

A territory defines an available resource which may service visits. A territory could be considered a sales-rep in this context which requires daily working hours (corresponding to the period) as well as a home location which serves as the start and end of each day.

### Schema definition

```protobuf
message Territory {
  required string id = 1;
  repeated float dailyStartTime = 2;
  repeated float dailyEndTime = 3;
  required Geocode location = 4;
}
```



### Fields

id
: A unique identifier for the sales-rep/territory. Duplicate id's in the [model](/nvd/model/) will result in an error.

dailyStartTime
: The time at which the sales-rep may start work on a particular day. If a single value is provided, it will be applied to the whole period, otherwise, it is expected to be the same length as the period defined in the [configuration](/nvd/configuration/).

dailyEndTime
: The time at which the sales-rep should end work on a particular day. If a single value is provided, it will be applied to the whole period, otherwise, it is expected to be the same length as the period defined in the [configuration](/nvd/configuration/).

location
: The [location](/nvd/geocode/) at which a sales rep should start and end each day in the period. Currently, only a single location is supported through the period.


### Examples

This example illustrates a simple case where the rep works from 08:00 to 16:00 each day in the period where the time is measured in minutes (see the [configuration](/nvd/configuration/)):
```protobuf
id: "My Sales Rep (@Guinness)"
dailyStartTime: 480
dailyEndTime: 960
location {
  longitude: -6.28681087
  latitude: 53.3416138
}
```



This example illustrates a case where a sales rep works a half day on Saturdays (a 6-day week with period length 6 is defined in the [configuration](/nvd/configuration/)) and the time is measured in minutes:

```protobuf
id: "My Sales Rep (@Guinness)"
dailyStartTime: 480
dailyStartTime: 480
dailyStartTime: 480
dailyStartTime: 480
dailyStartTime: 480
dailyStartTime: 480
dailyEndTime: 960
dailyEndTime: 960
dailyEndTime: 960
dailyEndTime: 960
dailyEndTime: 960
dailyEndTime: 720
location {
  longitude: -6.28681087
  latitude: 53.3416138
}
```



### Notes

* It is important that the dailyStartTime and dailyEndTime use the same convention of either one value for the period or a list of values that is the same length as the period length.

<hr>

