syntax = "proto3";

package com.wixpress.appservice.api;

import "google/protobuf/wrappers.proto";
import "wix/api/validations.proto";
import "google/api/annotations.proto";
import "wix/api/annotations.proto";
import "wix/api/callback.proto";
import "google/protobuf/timestamp.proto";
import "assets_messages.proto";
import "wix/api/entity.proto";

option java_package = "com.wixpress.appservice.api";

message Company {
    option (.wix.api.entity) = {
        fqdn: "wix.devcenter.companies.v1.company"
        segment: USERS
    };
    string company_id = 1 [(wix.api.format) = GUID];
    string name = 2 [(wix.api.minLength) = 1, (wix.api.maxLength) = 255];
    string email = 3 [(.wix.api.pii) = true];
    google.protobuf.StringValue phone = 4 [(wix.api.maxLength) = 255, (.wix.api.pii) = true]; //optional
    google.protobuf.StringValue website = 5 [(wix.api.maxLength) = 2083]; //optional
    string address = 6 [(wix.api.minLength) = 1, (wix.api.maxLength) = 255, (.wix.api.pii) = true];
    bool is_partner_agreement_signed = 7;
    bool is_subscribed = 8 ;
    google.protobuf.Timestamp active_since = 9;
    google.protobuf.StringValue description = 10 [(wix.api.maxLength) = 2083];//optional;
    map<string, com.wixpress.appservice.api.assets.Assets> assetsMap = 11; // map of all marketing assets
    string slug = 12;
    google.protobuf.StringValue user_id = 13 [(wix.api.format) = GUID];
    CompanyData data = 14;
    google.protobuf.StringValue meta_site_id = 15 [(wix.api.format) = GUID];
}

message CompanyData {
    // flynt-disable string-format-uri-forbidden
    google.protobuf.StringValue privacy_policy_url = 1 [(wix.api.format) = URI];
    google.protobuf.StringValue federal_tax_id = 2;
    google.protobuf.StringValue finance_contact = 3;
}



message GetCompanyByUserIdRequest {
    // user ID. if not provided, resolved from context.
    google.protobuf.StringValue user_id = 13 [(wix.api.format) = GUID];
}

message GetCompanyRequest {
    string company_id = 1 [(wix.api.format) = GUID];
}

message UpdateMetaSiteIdRequest {
    string company_id = 1 [(wix.api.format) = GUID];
    string meta_site_id = 2 [(wix.api.format) = GUID];
}

message UpdateCompanyRequest {
    string company_id = 1 [(wix.api.format) = GUID];
    Company company = 2;
}

message CreateCompanyRequest {
    Company company = 1;
}

message CompaniesResponse {
    repeated Company companies = 1;
}

message CompanyResponse {
    string company_id = 1 [(wix.api.readOnly) = true, (wix.api.format) = GUID];
    Company company = 2;
}

message UpdateMetaSiteIdResponse {
    string company_id = 1 [(wix.api.readOnly) = true, (wix.api.format) = GUID];
    Company company = 2;
}

message GetCompaniesByAppIdsRequest{
    repeated string app_ids = 1 [(wix.api.format) = GUID];
}

message GetCompaniesByAppIdsOrSlugsRequest{
    repeated string app_ids_or_slugs = 1;
}

message AppIdToCompanyResponse{
    map<string, Company> app_id_to_company = 1;
}

