syntax = "proto3"; // buf:lint:ignore PACKAGE_DIRECTORY_MATCH package github.com.alanwgt.fipex.v1; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/alanwgt/fipex/internal/protos/v1"; message YearOption { oneof specifier { uint32 model_year = 1; bool is_zero_km = 2; } } message Fuel { string id = 1; string acronym = 2; string name = 3; } message VehicleType { string id = 1; string name = 2; string slug = 3; } message ListVehicleTypesResponse { repeated VehicleType data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message ReferencePeriod { string id = 1; uint32 month = 2; string month_name = 3; uint32 year = 4; } message ListReferencePeriodsResponse { repeated ReferencePeriod data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message ListFuelTypesResponse { repeated Fuel data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message Model { string id = 1; string name = 2; string slug = 3; Make make = 4; VehicleType type = 5; repeated ModelYearFuels year_fuels = 6; } message SimplifiedModel { string id = 1; string name = 4; string make_id = 2; string slug = 3; } message GetModelResponse { Model data = 1; } message ListPricesResponse { repeated VehiclePriceSnapshot data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message VehiclePrice { uint32 price = 1; string formatted_price = 2; oneof year_specifier { uint32 model_year = 3; bool is_zero_km = 9; } google.protobuf.Timestamp query_date = 4; Make make = 5; Model model = 6; Fuel fuel = 7; ReferencePeriod reference = 8; } message GetPriceResponse { VehiclePrice data = 1; } message SearchModelsResponse { repeated SimplifiedModel data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message SearchPricesResponse { repeated VehiclePriceSnapshot data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message ModelYearFuels { oneof year_specifier { uint32 model_year = 1; bool is_zero_km = 3; } repeated Fuel fuels = 2; } enum ErrorCode { ERROR_CODE_UNSPECIFIED = 0; NOT_FOUND = 1; INVALID_INPUT = 2; INTERNAL_SERVER_ERROR = 3; CONFLICT = 4; UNSUPPORTED_MEDIA_TYPE = 5; VALIDATION_ERROR = 6; TOO_MANY_REQUESTS = 7; } message ErrorObject { ErrorCode code = 1; string message = 2; google.protobuf.StringValue target = 3; } message ApiError { string correlation_id = 1; repeated ErrorObject errors = 2; } message VehicleDetailedPrice { uint32 price = 1; string formatted_price = 2; oneof year_specifier { uint32 model_year = 3; bool is_zero_km = 10; } google.protobuf.Timestamp query_date = 4; Make make = 5; SimplifiedModel model = 6; Fuel fuel = 7; VehicleType type = 8; ReferencePeriod reference = 9; } message ExpandedPriceResponse { ExpandedPriceData data = 1; } message VehicleAnalytics { // --- Existing Fields --- float change_from_previous_month_pct = 1; float change_from_launch_pct = 2; float peak_to_now_pct_change = 3; // the price volatility of the vehicle, is and index not a percentage. google.protobuf.FloatValue price_volatility = 4; google.protobuf.UInt32Value price_rank = 5; google.protobuf.UInt32Value price_rank_total_in_category = 6; // --- New Fields from mv_vehicle_depreciation --- // The percentage of the original 'new car' value that the vehicle currently // retains. google.protobuf.FloatValue value_retention_pct = 7; // The average annual percentage rate at which the vehicle loses value. google.protobuf.FloatValue annual_depreciation_rate = 8; // --- New Field from mv_model_lifecycle --- // The current market status of the model (e.g., 'active', 'discontinued'). string lifecycle_status = 9; // --- New Fields from mv_price_anomalies --- // The status of the current price compared to its historical average (e.g., // 'normal', 'moderate_outlier'). google.protobuf.StringValue anomaly_status = 10; // The statistical Z-score of the current price. Values > 2 or < -2 are // significant. google.protobuf.FloatValue anomaly_z_score = 11; } message ExpandedPriceData { VehicleDetailedPrice price = 1; VehicleAnalytics analytics = 2; repeated VehiclePriceSnapshot history = 3; repeated YearOption available_years = 4; } message VehicleDetailedPriceResponse { VehicleDetailedPrice data = 1; } message VehiclePriceSnapshot { uint32 year = 1; uint32 month = 2; uint32 market_price_cents = 3; string formatted_price = 4; } message VehiclePriceHistoryResponse { repeated VehiclePriceSnapshot data = 1; } message ListModelsResponse { repeated SimplifiedModel data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message ListModelYearsResponse { repeated YearOption years = 1; } message SearchLabel { string id = 1; string name = 2; string slug = 3; } message SearchLabelResponse { repeated SearchLabel data = 1; Pagination pagination = 1000; PaginationLinks links = 1001; } message SearchHit { string price_id = 1; string model_id = 2; string model_name = 3; string model_slug = 4; string make_id = 5; string make_name = 6; string make_slug = 7; string fuel_id = 8; string fuel_name = 9; string fuel_acroym = 10; oneof year_specifier { uint32 model_year = 11; bool is_zero_km = 12; } uint32 latest_market_price_cents = 13; string type_id = 14; string type_name = 15; string latest_ref_id = 16; uint32 ref_month = 17; uint32 ref_year = 18; uint32 ref_fipe_id = 19; google.protobuf.Timestamp ref_ingested_at = 20; float score = 21; map matches = 22; } message SearchResponse { repeated SearchHit data = 1; uint32 estimated_total_hits = 2; uint32 time_taken_ms = 3; } // MAKES message Make { string id = 1; string name = 2; string slug = 3; } message GetMakeResponse { Make data = 1; } message ListMakesResponse { repeated Make data = 1; Pagination pagination = 2; PaginationLinks links = 3; } message Prelude { repeated Fuel fuels = 1; repeated VehicleType types = 2; repeated ReferencePeriod periods = 3; } // PAGINATION message Pagination { uint32 total = 1; uint32 limit = 2; uint32 offset = 3; uint32 page = 4; uint32 pages = 5; } message PaginationLinks { string self = 1; google.protobuf.StringValue next = 2; google.protobuf.StringValue prev = 3; string first = 4; string last = 5; } // Price Comparison Messages message VehicleWithHistory { string price_id = 1; string model_id = 2; string model_name = 3; string model_slug = 4; string make_id = 5; string make_name = 6; string make_slug = 7; string fuel_id = 8; string fuel_name = 9; string fuel_acronym = 10; string type_id = 11; string type_name = 12; oneof year_specifier { uint32 model_year = 13; bool is_zero_km = 14; } repeated VehiclePriceSnapshot price_history = 15; } message CompareVehiclePricesResponse { repeated VehicleWithHistory data = 1; }