syntax = "proto2";

package maps_adv.geosmb.clients.market.proto.services;

import "maps_adv/geosmb/clients/market/proto/common.proto";

// filter_services input
message FilterServicesParameters {
    required uint64 biz_id = 1;
    required common.PagingInputParameters paging = 2;
    repeated FilterServiceOrderingParameters ordering = 3;
    optional FilterServicesFilteringParameters filtering = 4;
}

// filter_services output
message ServiceList {
     required common.PagingOutputParameters paging  = 1;
     repeated FilterServiceOrderingParameters ordering = 2;
     repeated ServiceListItem items = 3;
}

message ServiceListItem {
    required uint64 id  = 1;
    required uint64 biz_id = 2;
    required string name = 3;
    required ServiceStatus status = 4;
    repeated uint64 category_ids = 5;
    optional common.Money min_price = 6;
    optional int32 duration_minutes = 7;
    optional string main_image_url_template = 8;
    required string updated_at = 9;  // datetime iso format
    repeated ServicePrice service_prices = 10;
    optional string description = 11;
    required PriceType price_type = 12;
    optional ClientAction client_action = 13;
    optional ClientActionSettings client_action_settings = 14;
}

message ClientActionSettings {
    optional ClientActionSettingsLink link = 1;
}

message ClientActionSettingsLink {
    required string link = 1;
    required string button_text = 2;
}

message ServicePrice {
    required uint64 service_id = 1;
    required common.Money price = 2;
    optional int32 duration_minutes = 3;
    oneof payload {
        ServiceSchedulePrices schedule = 4;
        ServiceLevelPrice price_level = 5;
    }
}

message ServiceSchedulePrices {
    required uint64 schedule_id = 1;
}

message ServiceLevelPrice {
    required int32 level = 1;
}

message FilterServiceOrderingParameters {
    required common.OrderType type = 1;
    required FilterServiceOrderingFields field = 2;
}

message FilterServicesFilteringParameters {
    optional string query = 1;
    repeated uint64 category_ids = 2;
    repeated ServiceStatus statuses = 3;
    optional bool include_without_categories = 4;
}

enum FilterServiceOrderingFields {
    NAME = 1;
    STATUS = 2;
    UPDATED_AT = 3;
    PRICE_MIN = 4;
    DURATION_MINUTES = 5;
}

enum ServiceStatus {
    DRAFT = 1;
    PUBLISHED = 2;
    DELETED = 3;
}

enum PriceType {
    UNKNOWN = 0;
    FIXED = 1;
    FROM = 2;
}

enum ClientAction {
    BOOKING_WITH_EMPLOYEE = 1;
    BOOKING_WITHOUT_EMPLOYEE = 2;
    REQUEST = 3;
    CALL = 4;
    LINK = 5;
}
