UNPKG

ocpi-types

Version:

TypeScript DTOs and enums for OCPI 2.2.1 specification.

132 lines 5.75 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TariffDto = void 0; const class_validator_1 = require("class-validator"); const class_transformer_1 = require("class-transformer"); const is_ocpi_datetime_decorator_1 = require("../../../decorators/is-ocpi-datetime.decorator"); const is_ocpi_ci_string_decorator_1 = require("../../../decorators/is-ocpi-ci-string.decorator"); const display_text_dto_1 = require("../../../dtos/display-text.dto"); const price_dto_1 = require("../../../dtos/price.dto"); const tariff_element_dto_1 = require("./tariff-element.dto"); const energy_mix_dto_1 = require("../../locations/dtos/energy-mix.dto"); const tariff_type_enum_1 = require("../enums/tariff-type.enum"); class TariffDto { countryCode; partyId; id; currency; type; tariffAltText; tariffAltUrl; minPrice; maxPrice; elements; startDateTime; endDateTime; energyMix; lastUpdated; } exports.TariffDto = TariffDto; __decorate([ (0, is_ocpi_ci_string_decorator_1.IsOcpiCiString)(), (0, class_validator_1.MinLength)(2), (0, class_validator_1.MaxLength)(2), (0, class_transformer_1.Expose)({ name: 'country_code' }), __metadata("design:type", String) ], TariffDto.prototype, "countryCode", void 0); __decorate([ (0, is_ocpi_ci_string_decorator_1.IsOcpiCiString)(), (0, class_validator_1.MinLength)(3), (0, class_validator_1.MaxLength)(3), (0, class_transformer_1.Expose)({ name: 'party_id' }), __metadata("design:type", String) ], TariffDto.prototype, "partyId", void 0); __decorate([ (0, is_ocpi_ci_string_decorator_1.IsOcpiCiString)(), (0, class_validator_1.MaxLength)(36), (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], TariffDto.prototype, "id", void 0); __decorate([ (0, class_validator_1.IsString)(), (0, class_validator_1.MaxLength)(3), (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], TariffDto.prototype, "currency", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_transformer_1.Expose)(), __metadata("design:type", String) ], TariffDto.prototype, "type", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsArray)(), (0, class_validator_1.ValidateNested)({ each: true }), (0, class_transformer_1.Type)(() => display_text_dto_1.DisplayTextDto), (0, class_transformer_1.Expose)({ name: 'tariff_alt_text' }), __metadata("design:type", Array) ], TariffDto.prototype, "tariffAltText", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.IsUrl)({}, { message: 'tariffAltUrl must be a valid URL', }), (0, class_transformer_1.Expose)({ name: 'tariff_alt_url' }), __metadata("design:type", String) ], TariffDto.prototype, "tariffAltUrl", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.ValidateNested)(), (0, class_transformer_1.Type)(() => price_dto_1.PriceDto), (0, class_transformer_1.Expose)({ name: 'min_price' }), __metadata("design:type", price_dto_1.PriceDto) ], TariffDto.prototype, "minPrice", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.ValidateNested)(), (0, class_transformer_1.Type)(() => price_dto_1.PriceDto), (0, class_transformer_1.Expose)({ name: 'max_price' }), __metadata("design:type", price_dto_1.PriceDto) ], TariffDto.prototype, "maxPrice", void 0); __decorate([ (0, class_validator_1.IsArray)(), (0, class_validator_1.ArrayMinSize)(1), (0, class_validator_1.ValidateNested)({ each: true }), (0, class_transformer_1.Type)(() => tariff_element_dto_1.TariffElementDto), (0, class_transformer_1.Expose)(), __metadata("design:type", Array) ], TariffDto.prototype, "elements", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, is_ocpi_datetime_decorator_1.IsOcpiDateTime)(), (0, class_transformer_1.Expose)({ name: 'start_date_time' }), __metadata("design:type", String) ], TariffDto.prototype, "startDateTime", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, is_ocpi_datetime_decorator_1.IsOcpiDateTime)(), (0, class_transformer_1.Expose)({ name: 'end_date_time' }), __metadata("design:type", String) ], TariffDto.prototype, "endDateTime", void 0); __decorate([ (0, class_validator_1.IsOptional)(), (0, class_validator_1.ValidateNested)(), (0, class_transformer_1.Type)(() => energy_mix_dto_1.EnergyMixDto), (0, class_transformer_1.Expose)({ name: 'energy_mix' }), __metadata("design:type", energy_mix_dto_1.EnergyMixDto) ], TariffDto.prototype, "energyMix", void 0); __decorate([ (0, is_ocpi_datetime_decorator_1.IsOcpiDateTime)(), (0, class_transformer_1.Expose)({ name: 'last_updated' }), __metadata("design:type", String) ], TariffDto.prototype, "lastUpdated", void 0); //# sourceMappingURL=tariff.dto.js.map